private void OnPostAuthorizeRequest(object sender, EventArgs e) { HttpApplication httpApplication = (HttpApplication)sender; HttpContext httpContext = httpApplication.Context; Diagnostics.SendWatsonReportOnUnhandledException(delegate() { if (Microsoft.Exchange.Diagnostics.Components.HttpProxy.ExTraceGlobals.VerboseTracer.IsTraceEnabled(TraceType.DebugTrace)) { Microsoft.Exchange.Diagnostics.Components.HttpProxy.ExTraceGlobals.VerboseTracer.TraceDebug((long)this.GetHashCode(), "[ProxyModule::OnPostAuthorizeRequest]: Method {0}; Url {1}; Username {2}; Context {3};", new object[] { httpContext.Request.HttpMethod, httpContext.Request.Url, (httpContext.User == null) ? string.Empty : httpContext.User.Identity.GetSafeName(true), httpContext.GetTraceContext() }); } this.OnPostAuthorizeInternal(httpApplication); LatencyTracker latencyTracker = LatencyTracker.FromHttpContext(httpContext); RequestDetailsLoggerBase <RequestDetailsLogger> .SafeSetLogger(RequestDetailsLoggerBase <RequestDetailsLogger> .GetCurrent(httpContext), ServiceLatencyMetadata.HttpPipelineLatency, latencyTracker.GetCurrentLatency(LatencyTrackerKey.ProxyModuleLatency)); long currentLatency = latencyTracker.GetCurrentLatency(LatencyTrackerKey.AuthenticationLatency); PerfCounters.UpdateMovingAveragePerformanceCounter(PerfCounters.HttpProxyCountersInstance.MovingAverageAuthenticationLatency, currentLatency); latencyTracker.StartTracking(LatencyTrackerKey.ModuleToHandlerSwitchingLatency, false); }, new Diagnostics.LastChanceExceptionHandler(RequestDetailsLogger.LastChanceExceptionHandler)); }
protected virtual void OnPostAuthorizeInternal(HttpApplication httpApplication) { HttpContext context = httpApplication.Context; if (NativeProxyHelper.CanNativeProxyHandleRequest(context)) { RequestDetailsLoggerBase <RequestDetailsLogger> .SafeAppendGenericInfo(RequestDetailsLoggerBase <RequestDetailsLogger> .GetCurrent(context), "ProxyRequestHandler", "NativeHttpProxy"); return; } IHttpHandler httpHandler; if (context.Request.IsAuthenticated) { httpHandler = this.SelectHandlerForAuthenticatedRequest(context); } else { httpHandler = this.SelectHandlerForUnauthenticatedRequest(context); } if (httpHandler != null) { if (Microsoft.Exchange.Diagnostics.Components.HttpProxy.ExTraceGlobals.VerboseTracer.IsTraceEnabled(TraceType.DebugTrace)) { Microsoft.Exchange.Diagnostics.Components.HttpProxy.ExTraceGlobals.VerboseTracer.TraceDebug <Type, object>((long)this.GetHashCode(), "[ProxyModule::OnPostAuthorizeInternal]: The selected HttpHandler is {0}; Context {1};", httpHandler.GetType(), context.Items[Constants.TraceContextKey]); } PerfCounters.HttpProxyCountersInstance.TotalRequests.Increment(); if (httpHandler is ProxyRequestHandler) { ((ProxyRequestHandler)httpHandler).Run(context); } else { context.RemapHandler(httpHandler); } long currentLatency = LatencyTracker.FromHttpContext(context).GetCurrentLatency(LatencyTrackerKey.ProxyModuleLatency); if (currentLatency > 100L) { RequestDetailsLoggerBase <RequestDetailsLogger> .SafeAppendGenericInfo(RequestDetailsLoggerBase <RequestDetailsLogger> .GetCurrent(context), "RemapHandler", currentLatency); } } }
private void OnAuthenticateRequest(object sender, EventArgs e) { HttpApplication httpApplication = (HttpApplication)sender; HttpContext httpContext = httpApplication.Context; Diagnostics.SendWatsonReportOnUnhandledException(delegate() { LatencyTracker latencyTracker = LatencyTracker.FromHttpContext(httpContext); latencyTracker.StartTracking(LatencyTrackerKey.AuthenticationLatency, false); if (Microsoft.Exchange.Diagnostics.Components.HttpProxy.ExTraceGlobals.VerboseTracer.IsTraceEnabled(TraceType.DebugTrace)) { Microsoft.Exchange.Diagnostics.Components.HttpProxy.ExTraceGlobals.VerboseTracer.TraceDebug <string, Uri, object>((long)this.GetHashCode(), "[ProxyModule::OnAuthenticateRequest]: Method {0}; Url {1}; Context {2};", httpContext.Request.HttpMethod, httpContext.Request.Url, httpContext.Items[Constants.TraceContextKey]); } this.OnAuthenticateInternal(httpApplication); long currentLatency = LatencyTracker.FromHttpContext(httpContext).GetCurrentLatency(LatencyTrackerKey.ProxyModuleLatency); if (currentLatency > 100L) { RequestDetailsLoggerBase <RequestDetailsLogger> .SafeAppendGenericInfo(RequestDetailsLoggerBase <RequestDetailsLogger> .GetCurrent(httpContext), "OnAuthenticate", currentLatency); } }, new Diagnostics.LastChanceExceptionHandler(RequestDetailsLogger.LastChanceExceptionHandler)); }
private void OnEndRequest(object sender, EventArgs e) { HttpApplication httpApplication = (HttpApplication)sender; HttpContext httpContext = httpApplication.Context; Diagnostics.SendWatsonReportOnUnhandledException(delegate() { LatencyTracker latencyTracker = LatencyTracker.FromHttpContext(httpContext); RequestDetailsLogger current = RequestDetailsLoggerBase <RequestDetailsLogger> .GetCurrent(httpContext); int traceContext = httpContext.GetTraceContext(); if (HttpProxyGlobals.ProtocolType != ProtocolType.Mapi) { OwaProxyRequestHandler.TryAddUnAuthenticatedPLTRequestPostDataToUriQueryOfIISLog(httpContext); } if (httpContext.Response != null && current != null) { httpContext.Response.AppendToLog(Constants.RequestIdKeyForIISLogs + current.ActivityId.ToString() + ";"); } if (HealthCheckResponder.Instance.IsHealthCheckRequest(httpContext)) { return; } if (httpContext.Response.StatusCode == 404 && httpContext.Response.SubStatusCode == 13) { httpContext.Response.StatusCode = 507; } if (Microsoft.Exchange.Diagnostics.Components.HttpProxy.ExTraceGlobals.VerboseTracer.IsTraceEnabled(TraceType.DebugTrace)) { Microsoft.Exchange.Diagnostics.Components.HttpProxy.ExTraceGlobals.VerboseTracer.TraceDebug((long)this.GetHashCode(), "[ProxyModule::OnEndRequest]: Method {0}; Url {1}; Username {2}; Context {3};", new object[] { httpContext.Request.HttpMethod, httpContext.Request.Url, (httpContext.User == null) ? string.Empty : httpContext.User.Identity.GetSafeName(true), traceContext }); } if (latencyTracker != null) { long currentLatency = latencyTracker.GetCurrentLatency(LatencyTrackerKey.HandlerToModuleSwitchingLatency); if (currentLatency >= 0L) { RequestDetailsLoggerBase <RequestDetailsLogger> .SafeSetLogger(current, HttpProxyMetadata.HandlerToModuleSwitchingLatency, currentLatency); } } ProxyRequestHandler proxyRequestHandler = httpContext.CurrentHandler as ProxyRequestHandler; if (proxyRequestHandler != null && !proxyRequestHandler.IsDisposed) { current.AppendGenericInfo("DisposeProxyRequestHandler", "ProxyModule::OnEndRequest"); proxyRequestHandler.Dispose(); } string value = httpContext.Items["AnonymousRequestFilterModule"] as string; if (!string.IsNullOrEmpty(value)) { current.AppendGenericInfo("AnonymousRequestFilterModule", value); } try { this.OnEndRequestInternal(httpApplication); } finally { if (current != null && !current.IsDisposed) { IActivityScope activityScope = current.ActivityScope; if (activityScope != null) { if (!string.IsNullOrEmpty(activityScope.TenantId)) { httpContext.Items["AuthenticatedUserOrganization"] = activityScope.TenantId; } ProxyModule.FinalizeRequestLatencies(httpContext, current, activityScope, latencyTracker, traceContext); } current.LogCurrentTime("EndRequest"); current.AsyncCommit(false); } if (Microsoft.Exchange.Diagnostics.Components.HttpProxy.ExTraceGlobals.VerboseTracer.IsTraceEnabled(TraceType.DebugTrace)) { Microsoft.Exchange.Diagnostics.Components.HttpProxy.ExTraceGlobals.VerboseTracer.TraceDebug(0L, "[ProxyModule::OnEndRequest]: Method {0}; Url {1}; OnEndRequestLatency {2}; Context {3};", new object[] { httpContext.Request.HttpMethod, httpContext.Request.Url, (latencyTracker != null) ? latencyTracker.GetCurrentLatency(LatencyTrackerKey.ProxyModuleLatency).ToString() : "Unknown", traceContext }); } } }, new Diagnostics.LastChanceExceptionHandler(RequestDetailsLogger.LastChanceExceptionHandler)); }
private IHttpHandler SelectHandlerForUnauthenticatedRequest(HttpContext httpContext) { IHttpHandler result; try { IHttpHandler httpHandler = null; if (HttpProxyGlobals.ProtocolType == ProtocolType.Autodiscover) { if (httpContext.Request.HttpMethod.Equals("GET", StringComparison.OrdinalIgnoreCase)) { if (ProtocolHelper.IsOAuthMetadataRequest(httpContext.Request.Url.AbsolutePath)) { httpHandler = new AuthMetadataHttpHandler(httpContext); } else if (ProtocolHelper.IsAutodiscoverV2Request(httpContext.Request.Url.AbsolutePath)) { httpHandler = new AutodiscoverProxyRequestHandler(); } } else { httpHandler = new AutodiscoverProxyRequestHandler(); } } else if (HttpProxyGlobals.ProtocolType == ProtocolType.Ews) { string httpMethod = httpContext.Request.HttpMethod; if (!httpMethod.Equals("GET", StringComparison.OrdinalIgnoreCase) && !httpMethod.Equals("HEAD", StringComparison.OrdinalIgnoreCase)) { httpHandler = new EwsProxyRequestHandler(); } } else if (HttpProxyGlobals.ProtocolType == ProtocolType.Ecp) { if (EDiscoveryExportToolProxyRequestHandler.IsEDiscoveryExportToolProxyRequest(httpContext.Request)) { httpHandler = new EDiscoveryExportToolProxyRequestHandler(); } else if (BEResourceRequestHandler.CanHandle(httpContext.Request)) { httpHandler = new BEResourceRequestHandler(); } else if (EcpProxyRequestHandler.IsCrossForestDelegatedRequest(httpContext.Request)) { httpHandler = new EcpProxyRequestHandler { IsCrossForestDelegated = true }; } else if (!httpContext.Request.Path.StartsWith("/ecp/auth/", StringComparison.OrdinalIgnoreCase) && !httpContext.Request.Path.Equals("/ecp/ping.ecp", StringComparison.OrdinalIgnoreCase)) { httpHandler = new Return401RequestHandler(); } } else if (HttpProxyGlobals.ProtocolType == ProtocolType.RpcHttp) { httpHandler = new RpcHttpRequestHandler(); } else if (HttpProxyGlobals.ProtocolType == ProtocolType.Xrop) { httpHandler = new XRopProxyRequestHandler(); } else if (HttpProxyGlobals.ProtocolType == ProtocolType.E4e) { httpHandler = new E4eProxyRequestHandler(); } else if (AnonymousCalendarProxyRequestHandler.IsAnonymousCalendarRequest(httpContext.Request)) { httpHandler = new AnonymousCalendarProxyRequestHandler(); } else if (HttpProxyGlobals.ProtocolType == ProtocolType.Owa && WopiRequestPathHandler.IsWopiRequest(httpContext.Request, AuthCommon.IsFrontEnd)) { httpHandler = new WopiProxyRequestHandler(); } else if (OwaExtensibilityProxyRequestHandler.IsOwaExtensibilityRequest(httpContext.Request)) { httpHandler = new OwaExtensibilityProxyRequestHandler(); } else if (OwaCobrandingRedirProxyRequestHandler.IsCobrandingRedirRequest(httpContext.Request)) { httpHandler = new OwaCobrandingRedirProxyRequestHandler(); } else if (HttpProxyGlobals.ProtocolType == ProtocolType.Owa && OwaResourceProxyRequestHandler.CanHandle(httpContext.Request)) { httpHandler = new OwaResourceProxyRequestHandler(); } else if (HttpProxyGlobals.ProtocolType == ProtocolType.PowerShellGateway) { httpHandler = new PsgwProxyRequestHandler(); } 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); }
private IHttpHandler SelectHandlerForAuthenticatedRequest(HttpContext httpContext) { IHttpHandler result; try { IHttpHandler httpHandler; if (HttpProxyGlobals.ProtocolType == ProtocolType.Mapi) { httpHandler = new MapiProxyRequestHandler(); } else if (HttpProxyGlobals.ProtocolType == ProtocolType.Ecp) { 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 == ProtocolType.Autodiscover) { httpHandler = new AutodiscoverProxyRequestHandler(); } else if (HttpProxyGlobals.ProtocolType == ProtocolType.Ews) { if (EwsUserPhotoProxyRequestHandler.IsUserPhotoRequest(httpContext.Request)) { httpHandler = new EwsUserPhotoProxyRequestHandler(); } else if (EwsODataProxyRequestHandler.IsODataRequest(httpContext.Request)) { httpHandler = new EwsODataProxyRequestHandler(); } 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 == ProtocolType.RpcHttp) { if (RpcHttpRequestHandler.CanHandleRequest(httpContext.Request)) { httpHandler = new RpcHttpRequestHandler(); } else { httpHandler = new RpcHttpProxyRequestHandler(); } } else if (HttpProxyGlobals.ProtocolType == ProtocolType.Eas) { httpHandler = new EasProxyRequestHandler(); } else if (HttpProxyGlobals.ProtocolType == ProtocolType.Oab) { httpHandler = new OabProxyRequestHandler(); } else if (HttpProxyGlobals.ProtocolType == ProtocolType.PowerShell || HttpProxyGlobals.ProtocolType == ProtocolType.PowerShellLiveId) { httpHandler = new RemotePowerShellProxyRequestHandler(); } else if (HttpProxyGlobals.ProtocolType == ProtocolType.ReportingWebService) { httpHandler = new ReportingWebServiceProxyRequestHandler(); } else if (HttpProxyGlobals.ProtocolType == ProtocolType.Psws) { httpHandler = new PswsProxyRequestHandler(); } else if (HttpProxyGlobals.ProtocolType == ProtocolType.Xrop) { httpHandler = new XRopProxyRequestHandler(); } else if (HttpProxyGlobals.ProtocolType == ProtocolType.Owa) { string absolutePath = httpContext.Request.Url.AbsolutePath; if (OWAUserPhotoProxyRequestHandler.IsUserPhotoRequest(httpContext.Request)) { httpHandler = new OWAUserPhotoProxyRequestHandler(); } else if (absolutePath.EndsWith("service.svc", StringComparison.OrdinalIgnoreCase) || absolutePath.IndexOf("/service.svc/", StringComparison.OrdinalIgnoreCase) != -1) { httpHandler = new EwsJsonProxyRequestHandler(); } else if (absolutePath.EndsWith("ev.owa2", StringComparison.OrdinalIgnoreCase)) { httpHandler = new OwaOeh2ProxyRequestHandler(); } else if (absolutePath.EndsWith("speech.reco", StringComparison.OrdinalIgnoreCase)) { httpHandler = new SpeechRecoProxyRequestHandler(); } else if (absolutePath.EndsWith("lang.owa", StringComparison.OrdinalIgnoreCase)) { httpHandler = new OwaLanguagePostProxyRequestHandler(); } else if (absolutePath.EndsWith("ev.owa", StringComparison.OrdinalIgnoreCase) && httpContext.Request.RawUrl.IndexOf("ns=EwsProxy", StringComparison.OrdinalIgnoreCase) > 0) { httpHandler = new EwsProxyRequestHandler(true); } else { httpHandler = new OwaProxyRequestHandler(); } } else if (HttpProxyGlobals.ProtocolType == ProtocolType.PushNotifications) { httpHandler = new PushNotificationsProxyRequestHandler(); } else if (HttpProxyGlobals.ProtocolType == ProtocolType.OutlookService) { httpHandler = new OutlookServiceProxyRequestHandler(); } else if (HttpProxyGlobals.ProtocolType == ProtocolType.SnackyService) { httpHandler = new SnackyServiceProxyRequestHandler(); } else if (HttpProxyGlobals.ProtocolType == ProtocolType.E4e) { httpHandler = new E4eProxyRequestHandler(); } else { if (HttpProxyGlobals.ProtocolType != ProtocolType.O365SuiteService) { throw new InvalidOperationException("Unknown protocol type " + HttpProxyGlobals.ProtocolType); } httpHandler = new O365SuiteServiceProxyRequestHandler(); } 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); }
// Token: 0x060005FB RID: 1531 RVA: 0x00021BD8 File Offset: 0x0001FDD8 private void OnEndRequest(object sender, EventArgs e) { HttpApplication httpApplication = (HttpApplication)sender; HttpContext httpContext = httpApplication.Context; CheckpointTracker.GetOrCreate(httpContext.Items).Add(FrontEndHttpProxyCheckpoints.ProxyModuleEndRequest); Diagnostics.SendWatsonReportOnUnhandledException(delegate() { if (!HostHeaderValidator.HasValidHostHeaderStatusDescription(new HttpContextWrapper(httpContext).Response) || httpContext.Items["AutodiscoverRedirectModule"] != null) { return; } LatencyTracker latencyTracker = LatencyTracker.FromHttpContext(httpContext); RequestDetailsLogger current = RequestDetailsLoggerBase <RequestDetailsLogger> .GetCurrent(httpContext); RequestDetailsLoggerBase <RequestDetailsLogger> .SafeAppendGenericInfo(RequestDetailsLoggerBase <RequestDetailsLogger> .GetCurrent(httpContext), GuardedSharedCacheExecution.Default.Key, GuardedSharedCacheExecution.Default.Guard.GetCurrentValue()); int traceContext = httpContext.GetTraceContext(); if (httpContext.Response != null && current != null) { httpContext.Response.AppendToLog(Constants.RequestIdKeyForIISLogs + current.ActivityId.ToString() + ";"); } if (HealthCheckResponder.Instance.IsHealthCheckRequest(httpContext)) { return; } if (httpContext.Response.StatusCode == 404 && httpContext.Response.SubStatusCode == 13) { httpContext.Response.StatusCode = 507; } if (ExTraceGlobals.VerboseTracer.IsTraceEnabled(1)) { ExTraceGlobals.VerboseTracer.TraceDebug((long)this.GetHashCode(), "[ProxyModule::OnEndRequest]: Method {0}; Url {1}; Username {2}; Context {3};", new object[] { httpContext.Request.HttpMethod, httpContext.Request.Url, (httpContext.User == null) ? string.Empty : IIdentityExtensions.GetSafeName(httpContext.User.Identity, true), traceContext }); } if (latencyTracker != null) { long currentLatency = latencyTracker.GetCurrentLatency(LatencyTrackerKey.HandlerToModuleSwitchingLatency); if (currentLatency >= 0L) { RequestDetailsLoggerBase <RequestDetailsLogger> .SafeSetLogger(current, 5, currentLatency); } } ProxyRequestHandler proxyRequestHandler = httpContext.CurrentHandler as ProxyRequestHandler; if (proxyRequestHandler != null && !proxyRequestHandler.IsDisposed) { current.AppendGenericInfo("DisposeProxyRequestHandler", "ProxyModule::OnEndRequest"); proxyRequestHandler.Dispose(); } ProxyModule.InspectNativeProxyFatalError(httpContext.Response, current); string text = httpContext.Items["AnonymousRequestFilterModule"] as string; if (!string.IsNullOrEmpty(text)) { current.AppendGenericInfo("AnonymousRequestFilterModule", text); } try { this.OnEndRequestInternal(httpApplication); } finally { if (current != null && !current.IsDisposed) { IActivityScope activityScope = current.ActivityScope; if (activityScope != null) { if (!string.IsNullOrEmpty(activityScope.TenantId)) { httpContext.Items["AuthenticatedUserOrganization"] = activityScope.TenantId; } ProxyModule.FinalizeRequestLatencies(httpContext, current, activityScope, latencyTracker, traceContext); } current.LogCurrentTime("EndRequest"); RequestDetailsLoggerBase <RequestDetailsLogger> .SafeSetLogger(current, 0, DateTime.UtcNow); current.AsyncCommit(false, NativeProxyHelper.WasProxiedByNativeProxyHandler(SharedHttpContextWrapper.GetWrapper(httpContext))); } if (ExTraceGlobals.VerboseTracer.IsTraceEnabled(1)) { ExTraceGlobals.VerboseTracer.TraceDebug(0L, "[ProxyModule::OnEndRequest]: Method {0}; Url {1}; OnEndRequestLatency {2}; Context {3};", new object[] { httpContext.Request.HttpMethod, httpContext.Request.Url, (latencyTracker != null) ? latencyTracker.GetCurrentLatency(LatencyTrackerKey.ProxyModuleLatency).ToString() : "Unknown", traceContext }); } } }, new Diagnostics.LastChanceExceptionHandler(RequestDetailsLogger.LastChanceExceptionHandler)); }
// Token: 0x060005F5 RID: 1525 RVA: 0x00021738 File Offset: 0x0001F938 private IHttpHandler SelectHandlerForUnauthenticatedRequest(HttpContext httpContext) { IHttpHandler result; try { if (HttpProxySettings.NeedHandleAsAuthenticatedRequest(httpContext.Request.Headers, httpContext.Request.Cookies, httpContext.SkipAuthorization)) { result = this.SelectHandlerForAuthenticatedRequest(httpContext); } else { UriBuilder uriBuilder = new UriBuilder(httpContext.Request.Url); string text = null; if (UrlUtilities.TryGetExplicitLogonUser(httpContext.Request, ref text)) { uriBuilder.Path = UrlUtilities.GetPathWithExplictLogonHint(httpContext.Request.Url, text); } IHttpHandler httpHandler = null; if (HttpProxyGlobals.ProtocolType == 9) { httpHandler = new AutodiscoverProxyRequestHandler(); } else if (HttpProxyGlobals.ProtocolType == 2) { if (RequestPathParser.IsEwsUnauthenticatedRequestProxyHandlerAllowed(httpContext.Request)) { httpHandler = new EwsProxyRequestHandler(); } } else if (HttpProxyGlobals.ProtocolType == 27) { if (RequestPathParser.IsRestUnauthenticatedRequestProxyHandlerAllowed(httpContext.Request)) { httpHandler = new RestProxyRequestHandler(); } } else if (HttpProxyGlobals.ProtocolType == 1) { if (EDiscoveryExportToolProxyRequestHandler.IsEDiscoveryExportToolProxyRequest(httpContext.Request)) { httpHandler = new EDiscoveryExportToolProxyRequestHandler(); } else if (BEResourceRequestHandler.CanHandle(httpContext.Request)) { httpHandler = new BEResourceRequestHandler(); } else if (EcpProxyRequestHandler.IsCrossForestDelegatedRequest(httpContext.Request)) { httpHandler = new EcpProxyRequestHandler { IsCrossForestDelegated = true }; } else if (!httpContext.Request.Path.StartsWith("/ecp/auth/", StringComparison.OrdinalIgnoreCase) && !httpContext.Request.Path.Equals("/ecp/ping.ecp", StringComparison.OrdinalIgnoreCase)) { httpHandler = new Return401RequestHandler(); } } else if (HttpProxyGlobals.ProtocolType == 8) { httpHandler = new RpcHttpRequestHandler(); } else if (HttpProxyGlobals.ProtocolType == 12) { httpHandler = new XRopProxyRequestHandler(); } else if (HttpProxyGlobals.ProtocolType == 15) { httpHandler = new E4eProxyRequestHandler(); } else if (AnonymousCalendarProxyRequestHandler.IsAnonymousCalendarRequest(httpContext.Request)) { httpHandler = new AnonymousCalendarProxyRequestHandler(); } else if (HttpProxyGlobals.ProtocolType == 4 && WopiRequestPathHandler.IsWopiRequest(httpContext.Request.HttpMethod, httpContext.Request.Url, AuthCommon.IsFrontEnd)) { httpHandler = new WopiProxyRequestHandler(); } else if (OwaExtensibilityProxyRequestHandler.IsOwaExtensibilityRequest(httpContext.Request)) { httpHandler = new OwaExtensibilityProxyRequestHandler(); } else if (UrlUtilities.IsOwaDownloadRequest(uriBuilder.Uri)) { httpHandler = new OwaDownloadProxyRequestHandler(); } else if (OwaCobrandingRedirProxyRequestHandler.IsCobrandingRedirRequest(httpContext.Request)) { httpHandler = new OwaCobrandingRedirProxyRequestHandler(); } else if (HttpProxyGlobals.ProtocolType == 4 && OwaResourceProxyRequestHandler.CanHandle(httpContext.Request)) { httpHandler = new OwaResourceProxyRequestHandler(); } else if (HttpProxyGlobals.ProtocolType == 19) { httpHandler = new PsgwProxyRequestHandler(); } else if (HttpProxyGlobals.ProtocolType == 21) { httpHandler = new MailboxDeliveryProxyRequestHandler(); } else if (HttpProxyGlobals.ProtocolType == 22) { httpHandler = new ComplianceServiceProxyRequestHandler(); } 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); }
// 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); }