// Token: 0x06000364 RID: 868 RVA: 0x0000D4CC File Offset: 0x0000B6CC internal BposAssetReader(string userPrincipalName, CultureInfo culture) { this.userPrincipalName = userPrincipalName; this.culture = culture; this.cacheKey = this.culture.Name; this.isMonitoringRequest = UserAgentUtilities.IsMonitoringRequest(HttpContext.Current.Request.UserAgent); }
private void AppendServerHeaders(OwaContext owaContext) { HttpContext httpContext = owaContext.HttpContext; if (httpContext == null || httpContext.Response == null || !UserAgentUtilities.IsMonitoringRequest(httpContext.Request.UserAgent)) { return; } try { if (owaContext.UserContext.ExchangePrincipal != null) { string shortServerNameFromFqdn = Utilities.GetShortServerNameFromFqdn(owaContext.UserContext.ExchangePrincipal.MailboxInfo.Location.ServerFqdn); if (shortServerNameFromFqdn != null) { httpContext.Response.AppendHeader("X-DiagInfoMailbox", shortServerNameFromFqdn); } } string lastRecipientSessionDCServerName = owaContext.UserContext.LastRecipientSessionDCServerName; if (lastRecipientSessionDCServerName != null) { httpContext.Response.AppendHeader("X-DiagInfoDomainController", Utilities.GetShortServerNameFromFqdn(lastRecipientSessionDCServerName)); } } catch (HttpException arg) { ExTraceGlobals.CoreTracer.TraceDebug <HttpException>(0L, "Exception happened while trying to append server name headers. Exception will be ignored: {0}", arg); } }
public void ProcessRequest(HttpContext httpContext) { ExTraceGlobals.OehCallTracer.TraceDebug(0L, "OwaEventHttpHandler.ProcessRequest"); try { ExTraceGlobals.OehTracer.TraceDebug(0L, "Parsing request"); OwaEventParserBase parser = this.GetParser(); this.EventHandler.SetParameterTable(parser.Parse()); ExTraceGlobals.OehTracer.TraceDebug <string>(0L, "Invoking event {0}", this.EventHandler.EventInfo.Name); if (Globals.CanaryProtectionRequired && !UserAgentUtilities.IsMonitoringRequest(httpContext.Request.UserAgent)) { Utilities.VerifyEventHandlerCanary(this.EventHandler); } this.EventHandler.EventInfo.MethodInfo.Invoke(this.EventHandler, BindingFlags.InvokeMethod, null, null, null); this.FinishSuccesfulRequest(); } catch (ThreadAbortException) { this.EventHandler.OwaContext.UnlockMinResourcesOnCriticalError(); } catch (TargetInvocationException ex) { ExTraceGlobals.OehTracer.TraceDebug(0L, "Handler invocation target threw an exception"); Utilities.HandleException(this.EventHandler.OwaContext, ex.InnerException, this.EventHandler.ShowErrorInPage); } finally { if (this.eventHandler != null) { this.eventHandler.Dispose(); } this.eventHandler = null; } }
private static void InsertIntoCache(HttpContext httpContext, IMailboxContext userContext) { UserContextManager.UserContextCacheWrapper userContextCacheWrapper = (UserContextManager.UserContextCacheWrapper)HttpRuntime.Cache.Get(userContext.Key.ToString()); if (userContextCacheWrapper == null) { userContextCacheWrapper = new UserContextManager.UserContextCacheWrapper { Lock = new OwaRWLockWrapper() }; } UserContextManager.TombstoneExistingUserContext(userContextCacheWrapper); userContextCacheWrapper.UserContext = userContext; int num = UserContextManager.UserContextTimeout; if (UserAgentUtilities.IsMonitoringRequest(httpContext.Request.UserAgent)) { num = 1; if (userContext.UserPrincipalName.EndsWith(".exchangemon.net", StringComparison.InvariantCultureIgnoreCase)) { ExMonitoringRequestTracker.Instance.ReportMonitoringRequest(httpContext.Request); } } HttpRuntime.Cache.Insert(userContext.Key.ToString(), userContextCacheWrapper, null, DateTime.MaxValue, new TimeSpan((long)num * 600000000L), CacheItemPriority.NotRemovable, new CacheItemRemovedCallback(UserContextManager.UserContextRemovedCallback)); userContext.LogBreadcrumb("Cached:Key=" + userContext.Key.ToString()); }
internal string GetThemeFolderName(UserAgent agent, HttpContext httpContext) { Theme theme = this.BaseTheme; if (agent != null && httpContext != null && !UserAgentUtilities.IsMonitoringRequest(agent.RawString) && agent.Layout == LayoutType.Mouse && !Globals.IsAnonymousCalendarApp) { UserContext userContext = UserContextManager.GetUserContext(httpContext); if (userContext != null) { theme = userContext.Theme; } } return(theme.FolderName); }
// Token: 0x0600014F RID: 335 RVA: 0x0000A0B0 File Offset: 0x000082B0 internal static void AddLatencyHeader(HttpContext httpContext, string header, long latency) { if (httpContext == null || httpContext.Response == null || !UserAgentUtilities.IsMonitoringRequest(httpContext.Request.UserAgent)) { return; } try { httpContext.Response.AppendHeader(header, latency.ToString()); } catch (HttpException arg) { ExTraceGlobals.PerformanceTracer.TraceDebug <HttpException>(0L, "Exception happened while trying to append latency headers. Exception will be ignored: {0}", arg); } }
internal List <IConnectedAccountsNotificationManager> GetConnectedAccountNotificationManagers(MailboxSession mailboxSession) { if (UserAgentUtilities.IsMonitoringRequest(HttpContext.Current.Request.UserAgent)) { return(new List <IConnectedAccountsNotificationManager>()); } if (this.isConnectedAccountsNotificationSetupDone) { return(this.connectedAccountNotificationManagers); } this.SetupTxSyncNotificationManager(mailboxSession); this.SetupMrsNotificationManager(mailboxSession); this.isConnectedAccountsNotificationSetupDone = true; return(this.connectedAccountNotificationManagers); }
internal override ExchangePrincipal InternalCreateExchangePrincipal() { ExTraceGlobals.CoreCallTracer.TraceDebug <string>(0L, "OwaClientSecurityContextIdentity.CreateExchangePrincipal Creating scoped AD session for {0}", (base.UserOrganizationId == null) ? this.DomainName : base.UserOrganizationId.ToString()); bool flag = HttpContext.Current != null && UserAgentUtilities.IsMonitoringRequest(HttpContext.Current.Request.UserAgent); ExchangePrincipal result; try { ADSessionSettings sessionSettings = (base.UserOrganizationId == null) ? UserContextUtilities.CreateScopedSessionSettings(this.DomainName, null) : UserContextUtilities.CreateScopedSessionSettings(null, base.UserOrganizationId); IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(null, true, ConsistencyMode.IgnoreInvalid, null, sessionSettings, 417, "InternalCreateExchangePrincipal", "f:\\15.00.1497\\sources\\dev\\clients\\src\\Owa2\\Server\\Core\\common\\OwaClientSecurityContextIdentity.cs"); if (flag) { TimeSpan value = TimeSpan.FromSeconds((double)OwaClientSecurityContextIdentity.ADTimeoutForExchangePrincipalInstantiation.Value); ExTraceGlobals.CoreCallTracer.TraceDebug <double>(0L, "OwaClientSecurityContextIdentity.CreateExchangePrincipal Reduced AD timeout to {0} seconds", value.TotalSeconds); tenantOrRootOrgRecipientSession.ClientSideSearchTimeout = new TimeSpan?(value); } ExTraceGlobals.CoreCallTracer.TraceDebug(0L, "OwaClientSecurityContextIdentity.CreateExchangePrincipal Calling ExchangePrincipal.FromUserSid"); try { result = ExchangePrincipal.FromUserSid(tenantOrRootOrgRecipientSession, this.UserSid); } catch (UserHasNoMailboxException ex) { ADUser aduser = tenantOrRootOrgRecipientSession.FindBySid(this.UserSid) as ADUser; ex.Data.Add("PrimarySmtpAddress", this.logonName); if (aduser == null) { throw; } if (aduser.RecipientType == RecipientType.MailUser && aduser.SKUAssigned != true) { throw new OwaUserHasNoMailboxAndNoLicenseAssignedException(ex.Message, ex.InnerException); } throw; } } catch (Exception ex2) { OwaDiagnostics.Logger.LogEvent(ClientsEventLogConstants.Tuple_OwaFailedToCreateExchangePrincipal, string.Empty, new object[] { this.UserSid, flag, ex2 }); throw; } return(result); }
private static void AppendLatencyHeaders(long rpcLatency, long ldapLatency, long requestLatency) { HttpContext httpContext = HttpContext.Current; if (httpContext == null || httpContext.Response == null || !UserAgentUtilities.IsMonitoringRequest(httpContext.Request.UserAgent)) { return; } try { httpContext.Response.AppendHeader("X-DiagInfoRpcLatency", rpcLatency.ToString()); httpContext.Response.AppendHeader("X-DiagInfoLdapLatency", ldapLatency.ToString()); httpContext.Response.AppendHeader("X-DiagInfoIisLatency", requestLatency.ToString()); } catch (HttpException arg) { ExTraceGlobals.PerformanceTracer.TraceDebug <HttpException>(0L, "Exception happened while trying to append latency headers. Exception will be ignored: {0}", arg); } }
// Token: 0x0600115E RID: 4446 RVA: 0x00042B38 File Offset: 0x00040D38 private static void FinalizeResponse() { HttpRequest request = HttpContext.Current.Request; HttpResponse response = HttpContext.Current.Response; RequestDetailsLogger getRequestDetailsLogger = OwaApplication.GetRequestDetailsLogger; if (getRequestDetailsLogger != null && getRequestDetailsLogger.ActivityScope != null) { string property = getRequestDetailsLogger.ActivityScope.GetProperty(ServiceCommonMetadata.ExceptionName); double totalMilliseconds = getRequestDetailsLogger.ActivityScope.TotalMilliseconds; string property2 = getRequestDetailsLogger.ActivityScope.GetProperty(ServiceCommonMetadata.CorrectBEServerToUse); AggregatedOperationStatistics aggregatedOperationStatistics = getRequestDetailsLogger.ActivityScope.TakeStatisticsSnapshot(AggregatedOperationType.ADCalls); AggregatedOperationStatistics aggregatedOperationStatistics2 = getRequestDetailsLogger.ActivityScope.TakeStatisticsSnapshot(AggregatedOperationType.StoreRPCs); string value = string.Format(CultureInfo.InvariantCulture, "{0:F0};{1:F0};{2:F0}", new object[] { totalMilliseconds, aggregatedOperationStatistics.TotalMilliseconds, aggregatedOperationStatistics2.TotalMilliseconds }); try { response.Headers.Add("X-OWA-DiagnosticsInfo", value); if (!string.IsNullOrEmpty(property)) { response.Headers["X-OWA-Error"] = property; } if (!string.IsNullOrWhiteSpace(property2)) { response.Headers[WellKnownHeader.XDBMountedOnServer] = property2; } if (UserAgentUtilities.IsMonitoringRequest(request.UserAgent)) { response.Headers["X-DiagInfoLdapLatency"] = aggregatedOperationStatistics.TotalMilliseconds.ToString("F0"); response.Headers["X-DiagInfoRpcLatency"] = aggregatedOperationStatistics2.TotalMilliseconds.ToString("F0"); response.Headers["X-DiagInfoIisLatency"] = totalMilliseconds.ToString("F0"); } } catch (Exception arg) { ExTraceGlobals.ConfigurationManagerTracer.TraceDebug <Exception>(0L, "Exception occurred while attempting to append diagnostic headers, exception will be ignored: {0}", arg); } } }
protected override OwaUserConfiguration InternalExecute() { MailboxSession mailboxIdentityMailboxSession = base.MailboxIdentityMailboxSession; UserContext userContext = UserContextManager.GetUserContext(CallContext.Current.HttpContext, CallContext.Current.EffectiveCaller, true); UserConfigurationManager.IAggregationContext aggregationContext = null; OwaUserConfiguration result; try { if (!DefaultPageBase.IsRecoveryBoot(base.CallContext.HttpContext)) { using (UserConfigurationManager.IAggregationContext aggregationContext2 = userContext.TryConsumeBootAggregation()) { if (aggregationContext2 != null) { aggregationContext = mailboxIdentityMailboxSession.UserConfigurationManager.AttachAggregator(aggregationContext2); } else { aggregationContext = this.CreateAggregatedConfiguration(userContext, mailboxIdentityMailboxSession); } } } UserOptionsType userOptionsType = new UserOptionsType(); userOptionsType.Load(mailboxIdentityMailboxSession, true, true); OwaUserConfiguration owaUserConfiguration = new OwaUserConfiguration(); owaUserConfiguration.UserOptions = userOptionsType; string userAgent = CallContext.Current.HttpContext.Request.UserAgent; UserAgent userAgent2 = new UserAgent(userAgent, userContext.FeaturesManager.ClientServerSettings.ChangeLayout.Enabled, base.CallContext.HttpContext.Request.Cookies); StorePerformanceCountersCapture countersCapture = StorePerformanceCountersCapture.Start(mailboxIdentityMailboxSession); UMSettingsData umSettings = this.ReadAggregatedUMSettingsData(aggregationContext, userContext.ExchangePrincipal); OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.UMClient, countersCapture, true); owaUserConfiguration.SessionSettings = new SessionSettingsType(userContext, mailboxIdentityMailboxSession, userAgent2, base.CallContext, umSettings, this.ReadAggregatedOwaHelpUrlData(aggregationContext, Thread.CurrentThread.CurrentUICulture, userContext.MailboxIdentity, userAgent2)); OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.SessionSettings, countersCapture, true); ConfigurationContext configurationContext = new ConfigurationContext(userContext, aggregationContext); string defaultTheme = configurationContext.DefaultTheme; OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.ConfigContext, countersCapture, true); owaUserConfiguration.SegmentationSettings = new SegmentationSettingsType(configurationContext); owaUserConfiguration.SegmentationSettings.InstantMessage &= !UserAgentUtilities.IsMonitoringRequest(userAgent); owaUserConfiguration.SegmentationSettings.InstantMessage &= VdirConfiguration.Instance.InstantMessagingEnabled; OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.SegmentationSettings, countersCapture, true); WacConfigData wacData = AttachmentPolicy.ReadAggregatedWacData(userContext, aggregationContext); owaUserConfiguration.AttachmentPolicy = configurationContext.AttachmentPolicy.CreateAttachmentPolicyType(userContext, userAgent2, wacData); OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.AttachmentPolicy, countersCapture, true); PolicySettingsType policySettingsType = new PolicySettingsType(); policySettingsType.PlacesEnabled = (this.placesConfigurationCache.IsFeatureEnabled && configurationContext.PlacesEnabled && !PlacesConfigurationCache.IsRestrictedCulture(owaUserConfiguration.SessionSettings.UserCulture)); policySettingsType.WeatherEnabled = (this.weatherConfigurationCache.IsFeatureEnabled && configurationContext.WeatherEnabled && !this.weatherConfigurationCache.IsRestrictedCulture(owaUserConfiguration.SessionSettings.UserCulture)); OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.PlacesWeather, countersCapture, true); policySettingsType.DefaultTheme = configurationContext.DefaultTheme; policySettingsType.InstantMessagingType = configurationContext.InstantMessagingType; policySettingsType.UseGB18030 = configurationContext.UseGB18030; policySettingsType.UseISO885915 = configurationContext.UseISO885915; policySettingsType.OutboundCharset = configurationContext.OutboundCharset; policySettingsType.AllowCopyContactsToDeviceAddressBook = configurationContext.AllowCopyContactsToDeviceAddressBook; policySettingsType.AllowOfflineOnString = configurationContext.AllowOfflineOn.ToString(); policySettingsType.MySiteUrl = configurationContext.MySiteUrl; owaUserConfiguration.PolicySettings = policySettingsType; OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.PolicySettings, countersCapture, true); owaUserConfiguration.MobileDevicePolicySettings = MobileDevicePolicyDataFactory.GetPolicySettings(this.ReadAggregatedMobileDevicePolicyData(aggregationContext, userContext.ExchangePrincipal)); owaUserConfiguration.ApplicationSettings = this.GetApplicationSettings(); owaUserConfiguration.ViewStateConfiguration = new OwaViewStateConfiguration(); owaUserConfiguration.ViewStateConfiguration.LoadAll(mailboxIdentityMailboxSession); OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.OwaViewStateConfiguration, countersCapture, true); OrganizationId organizationId = mailboxIdentityMailboxSession.MailboxOwner.MailboxInfo.OrganizationId; this.SetUserConfigPropertiesFromOrganizationConfig(aggregationContext, organizationId, owaUserConfiguration); userContext.IsPublicLogon = (owaUserConfiguration.SessionSettings.IsPublicLogon || (owaUserConfiguration.PublicComputersDetectionEnabled && owaUserConfiguration.SessionSettings.IsPublicComputerSession)); OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.GetMailTipsLargeAudienceThreshold, countersCapture, true); owaUserConfiguration.RetentionPolicyTags = this.GetRetentionPolicyTags(mailboxIdentityMailboxSession); OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.GetRetentionPolicyTags, countersCapture, true); try { owaUserConfiguration.MasterCategoryList = MasterCategoryListHelper.GetMasterCategoryListType(mailboxIdentityMailboxSession, base.CallContext.OwaCulture); } catch (QuotaExceededException ex) { ExTraceGlobals.UserContextCallTracer.TraceDebug <string>(0L, "GetOwaUserConfiguration: Get MasterCategoryList failed. Exception: {0}", ex.Message); } OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.GetMasterCategoryListType, countersCapture, true); owaUserConfiguration.MaxRecipientsPerMessage = this.GetMaxRecipientsPerMessage(); OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.GetMaxRecipientsPerMessage, countersCapture, false); owaUserConfiguration.RecoverDeletedItemsEnabled = configurationContext.RecoverDeletedItemsEnabled; base.CallContext.ProtocolLog.Set(OwaUserConfigurationLogMetadata.UserCulture, owaUserConfiguration.SessionSettings.UserCulture); Converter <KeyValuePair <string, string>, string> converter; if (userContext.FeaturesManager.ServerSettings.FlightFormat.Enabled) { converter = ((KeyValuePair <string, string> pair) => "&" + pair.Key + ":" + pair.Value); } else { converter = ((KeyValuePair <string, string> pair) => pair.Key + " = " + pair.Value); } if (userContext.FeaturesManager.ConfigurationSnapshot != null && userContext.FeaturesManager.ClientSettings.OWADiagnostics.Enabled) { owaUserConfiguration.FlightConfiguration = Array.ConvertAll <KeyValuePair <string, string>, string>(userContext.FeaturesManager.ConfigurationSnapshot.Constraints, converter); } else { owaUserConfiguration.FlightConfiguration = new string[0]; } this.ReadInferenceSettings(mailboxIdentityMailboxSession, userContext, owaUserConfiguration); if (base.CallContext.IsSmimeInstalled) { owaUserConfiguration.SmimeAdminSettings = new SmimeAdminSettingsType(this.ReadAggregatedSmimeData(aggregationContext, organizationId)); } VariantConfigurationSnapshot configurationSnapshot = userContext.FeaturesManager.ConfigurationSnapshot; if (configurationSnapshot != null) { IInlineExploreSettings inlineExploreSettings = configurationSnapshot.OwaServer.InlineExploreSettings; if (inlineExploreSettings != null) { owaUserConfiguration.InlineExploreContent = inlineExploreSettings.Content; } } owaUserConfiguration.PolicyTipsEnabled = this.ReadAggregatedPolicyTipsData(aggregationContext, organizationId).IsPolicyTipsEnabled; UserContext.ReadAggregatedFlightConfigData(aggregationContext, organizationId); this.RecordAggregationStats(aggregationContext); result = owaUserConfiguration; } finally { this.ValidateAndDisposeAggregatedConfiguration(aggregationContext, mailboxIdentityMailboxSession); } return(result); }
// Token: 0x0600095C RID: 2396 RVA: 0x0001FED4 File Offset: 0x0001E0D4 internal static VdirConfiguration GetInstance(NameValueCollection requestHeaders = null, string requestUserAgent = null, string rawUrl = null, Uri uri = null, string userHostAddress = null, bool?isLocal = false) { if (VdirConfiguration.useBackendVdirConfiguration || Globals.IsPreCheckinApp) { lock (VdirConfiguration.syncRoot) { if (VdirConfiguration.instance == null || VdirConfiguration.instance.expirationTime < DateTime.UtcNow) { VdirConfiguration.instance = (Globals.IsPreCheckinApp ? new VdirConfiguration() : VdirConfiguration.CreateInstance(Guid.Empty)); } } return(VdirConfiguration.instance); } if (!VdirConfiguration.IsRequestFromCafe(requestHeaders ?? HttpContext.Current.Request.Headers) && UserAgentUtilities.IsMonitoringRequest(requestUserAgent ?? HttpContext.Current.Request.UserAgent)) { return(new VdirConfiguration()); } Guid requestVdirObjectGuid = VdirConfiguration.GetRequestVdirObjectGuid(requestHeaders, requestUserAgent, rawUrl, uri, userHostAddress, isLocal); VdirConfiguration result; lock (VdirConfiguration.syncRoot) { VdirConfiguration.RemoveEntriesIfExpired(); VdirConfiguration vdirConfiguration; if (VdirConfiguration.instances.TryGetValue(requestVdirObjectGuid, out vdirConfiguration)) { result = vdirConfiguration; } else { try { vdirConfiguration = VdirConfiguration.CreateInstance(requestVdirObjectGuid); VdirConfiguration.instances.Add(requestVdirObjectGuid, vdirConfiguration); if (VdirConfiguration.minExpirationTime > vdirConfiguration.expirationTime) { VdirConfiguration.minExpirationTime = vdirConfiguration.expirationTime; } } catch (ADConfigurationException innerException) { throw new InvalidRequestException(innerException); } result = vdirConfiguration; } } return(result); }