private OwaClientSecurityContextIdentity(ClientSecurityContext clientSecurityContext, string logonName, string authenticationType, OrganizationId userOrganizationId)
 {
     if (clientSecurityContext == null)
     {
         throw new ArgumentNullException("clientSecurityContext");
     }
     if (string.IsNullOrEmpty(logonName))
     {
         throw new ArgumentNullException("logonName", "logonName cannot be null or empty.");
     }
     if (userOrganizationId == null && !OwaIdentity.IsLogonNameFullyQualified(logonName))
     {
         throw new ArgumentException("logonName", string.Format(CultureInfo.InvariantCulture, "'{0}' is not a valid logon name.", new object[]
         {
             logonName
         }));
     }
     if (string.IsNullOrEmpty(authenticationType))
     {
         throw new ArgumentNullException("authenticationType", "authenticationType cannot be null or empty.");
     }
     this.logonName          = logonName;
     this.authenticationType = authenticationType;
     base.UserOrganizationId = userOrganizationId;
     if (!SyncUtilities.IsDatacenterMode())
     {
         this.clientSecurityContext = clientSecurityContext;
         OWAMiniRecipient owaminiRecipient = base.GetOWAMiniRecipient();
         if (owaminiRecipient != null && owaminiRecipient.MasterAccountSid != null)
         {
             try
             {
                 this.clientSecurityContext = OwaClientSecurityContextIdentity.TokenMunger.MungeToken(clientSecurityContext, OrganizationId.ForestWideOrgId);
                 return;
             }
             catch (TokenMungingException ex)
             {
                 ExTraceGlobals.CoreCallTracer.TraceError(0L, "OwaClientSecurityContextIdentity.TokenMunger.MungeToken for LogonName='{0}', AuthenticationType='{1}', UserOrgId='{2}' failed with exception: {3}", new object[]
                 {
                     this.logonName,
                     this.authenticationType,
                     base.UserOrganizationId,
                     ex.Message
                 });
             }
         }
     }
     this.clientSecurityContext = clientSecurityContext.Clone();
 }
Example #2
0
        protected override void StampChangesOnXsoObject(IConfigurable dataObject)
        {
            base.StampChangesOnXsoObject(dataObject);
            MailboxMessageConfiguration mailboxMessageConfiguration = (MailboxMessageConfiguration)dataObject;

            if (mailboxMessageConfiguration.IsModified(MailboxMessageConfigurationSchema.SignatureHtml))
            {
                mailboxMessageConfiguration.SignatureHtml = TextConverterHelper.SanitizeHtml(mailboxMessageConfiguration.SignatureHtml);
                if (!mailboxMessageConfiguration.IsModified(MailboxMessageConfigurationSchema.SignatureText))
                {
                    mailboxMessageConfiguration.SignatureText = TextConverterHelper.HtmlToText(mailboxMessageConfiguration.SignatureHtml, true);
                }
            }
            else if (mailboxMessageConfiguration.IsModified(MailboxMessageConfigurationSchema.SignatureText))
            {
                mailboxMessageConfiguration.SignatureHtml = TextConverterHelper.TextToHtml(mailboxMessageConfiguration.SignatureText);
            }
            if (SyncUtilities.IsDatacenterMode() && mailboxMessageConfiguration.IsModified(MailboxMessageConfigurationSchema.SendAddressDefault))
            {
                SendAsDefaultsManager sendAsDefaultsManager = new SendAsDefaultsManager();
                sendAsDefaultsManager.SaveSettingForOutlook(mailboxMessageConfiguration.SendAddressDefault, this.mailboxSession);
            }
            this.mailboxSession = null;
        }
Example #3
0
        // Token: 0x0600211A RID: 8474 RVA: 0x0007953C File Offset: 0x0007773C
        internal SessionSettingsType(UserContext userContext, MailboxSession mailboxSession, UserAgent userAgent, CallContext callContext, UMSettingsData umSettings, OwaHelpUrlData helpUrlData)
        {
            if (userContext == null)
            {
                throw new ArgumentNullException("userContext");
            }
            if (userContext.ExchangePrincipal == null)
            {
                throw new OwaInvalidRequestException("userContext.ExchangePrincipal is null");
            }
            StorePerformanceCountersCapture countersCapture = StorePerformanceCountersCapture.Start(mailboxSession);

            this.userDisplayName      = userContext.ExchangePrincipal.MailboxInfo.DisplayName;
            this.userEmailAddress     = userContext.ExchangePrincipal.MailboxInfo.PrimarySmtpAddress.ToString();
            this.userLegacyExchangeDN = userContext.ExchangePrincipal.LegacyDn;
            this.hasArchive           = this.UserHasArchive(userContext.ExchangePrincipal);
            this.archiveDisplayName   = (this.hasArchive ? userContext.ExchangePrincipal.GetArchiveMailbox().ArchiveName : string.Empty);
            IEnumerable <string> source = from emailAddress in userContext.ExchangePrincipal.MailboxInfo.EmailAddresses
                                          select emailAddress.AddressString;

            if (source.Any <string>())
            {
                this.userProxyAddresses = source.ToArray <string>();
            }
            this.UpdateMailboxQuotaLimits(mailboxSession);
            this.isBposUser        = userContext.IsBposUser;
            this.userSipUri        = userContext.SipUri;
            this.userPrincipalName = userContext.UserPrincipalName;
            this.isGallatin        = SessionSettingsType.GetIsGallatin();
            if (userContext.ExchangePrincipal.MailboxInfo.OrganizationId != null)
            {
                this.TenantGuid = userContext.ExchangePrincipal.MailboxInfo.OrganizationId.GetTenantGuid().ToString();
            }
            if (userContext.LogEventCommonData != null)
            {
                this.TenantDomain = userContext.LogEventCommonData.TenantDomain;
            }
            OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.SessionSettingsMisc, countersCapture, true);
            int?maximumMessageSize = SessionSettingsType.GetMaximumMessageSize(mailboxSession);

            this.maxMessageSizeInKb = ((maximumMessageSize != null) ? maximumMessageSize.Value : 5120);
            OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.SessionSettingsMessageSize, countersCapture, true);
            this.isPublicLogon = UserContextUtilities.IsPublicRequest(callContext.HttpContext.Request);
            OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.SessionSettingsIsPublicLogon, countersCapture, true);
            ADUser aduser = null;

            if (userContext.IsExplicitLogon)
            {
                IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(null, true, ConsistencyMode.IgnoreInvalid, null, userContext.ExchangePrincipal.MailboxInfo.OrganizationId.ToADSessionSettings(), 303, ".ctor", "f:\\15.00.1497\\sources\\dev\\clients\\src\\Owa2\\Server\\Core\\types\\SessionSettingsType.cs");
                aduser = (DirectoryHelper.ReadADRecipient(userContext.ExchangePrincipal.MailboxInfo.MailboxGuid, userContext.ExchangePrincipal.MailboxInfo.IsArchive, tenantOrRootOrgRecipientSession) as ADUser);
                if (aduser != null && aduser.SharePointUrl != null)
                {
                    this.sharePointUrl   = aduser.SharePointUrl.ToString();
                    this.sharePointTitle = aduser.DisplayName;
                }
            }
            OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.TeamMailbox, countersCapture, true);
            if (userContext.LogonIdentity != null)
            {
                OWAMiniRecipient owaminiRecipient = userContext.LogonIdentity.GetOWAMiniRecipient();
                this.LogonEmailAddress = string.Empty;
                if (owaminiRecipient != null)
                {
                    SmtpAddress primarySmtpAddress = owaminiRecipient.PrimarySmtpAddress;
                    this.LogonEmailAddress = owaminiRecipient.PrimarySmtpAddress.ToString();
                }
                OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.GetOWAMiniRecipient, countersCapture, false);
            }
            this.MailboxGuid     = userContext.ExchangePrincipal.MailboxInfo.MailboxGuid.ToString();
            this.isExplicitLogon = userContext.IsExplicitLogon;
            this.isExplicitLogonOthersMailbox = false;
            this.canActAsOwner = true;
            countersCapture    = StorePerformanceCountersCapture.Start(mailboxSession);
            this.SetDefaultFolderMapping(mailboxSession);
            OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.SetDefaultFolderMapping, countersCapture, false);
            CultureInfo currentUICulture = Thread.CurrentThread.CurrentUICulture;

            this.userCulture = currentUICulture.Name;
            this.isUserCultureSpeechEnabled = Culture.IsCultureSpeechEnabled(currentUICulture);
            this.isUserCultureRightToLeft   = currentUICulture.TextInfo.IsRightToLeft;
            countersCapture                    = StorePerformanceCountersCapture.Start(mailboxSession);
            this.playOnPhoneDialString         = umSettings.PlayOnPhoneDialString;
            this.isRequireProtectedPlayOnPhone = umSettings.IsRequireProtectedPlayOnPhone;
            this.isUMEnabled                   = umSettings.IsUMEnabled;
            if (SyncUtilities.IsDatacenterMode())
            {
                SendAsSubscriptionsAndPeopleConnectResult allSendAsSubscriptionsAndPeopleConnect = SubscriptionManager.GetAllSendAsSubscriptionsAndPeopleConnect(mailboxSession);
                List <PimAggregationSubscription>         pimSendAsAggregationSubscriptionList   = allSendAsSubscriptionsAndPeopleConnect.PimSendAsAggregationSubscriptionList;
                this.PeopleConnectionsExist = allSendAsSubscriptionsAndPeopleConnect.PeopleConnectionsExist;
                List <AggregatedAccountInfo> list = null;
                if (aduser == null && userContext.ExchangePrincipal != null)
                {
                    IRecipientSession tenantOrRootOrgRecipientSession2 = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(null, true, ConsistencyMode.IgnoreInvalid, null, userContext.ExchangePrincipal.MailboxInfo.OrganizationId.ToADSessionSettings(), 375, ".ctor", "f:\\15.00.1497\\sources\\dev\\clients\\src\\Owa2\\Server\\Core\\types\\SessionSettingsType.cs");
                    aduser = (DirectoryHelper.ReadADRecipient(userContext.ExchangePrincipal.MailboxInfo.MailboxGuid, userContext.ExchangePrincipal.MailboxInfo.IsArchive, tenantOrRootOrgRecipientSession2) as ADUser);
                }
                if (aduser != null)
                {
                    AggregatedAccountHelper aggregatedAccountHelper = new AggregatedAccountHelper(mailboxSession, aduser);
                    list = aggregatedAccountHelper.GetListOfAccounts();
                }
                int capacity = pimSendAsAggregationSubscriptionList.Count + ((list != null) ? list.Count : 0);
                List <ConnectedAccountInfo> list2 = new List <ConnectedAccountInfo>(capacity);
                foreach (PimAggregationSubscription pimAggregationSubscription in pimSendAsAggregationSubscriptionList)
                {
                    list2.Add(new ConnectedAccountInfo
                    {
                        SubscriptionGuid = pimAggregationSubscription.SubscriptionGuid,
                        EmailAddress     = SessionSettingsType.DecodeIdnDomain(pimAggregationSubscription.UserEmailAddress),
                        DisplayName      = pimAggregationSubscription.UserDisplayName
                    });
                }
                if (list != null)
                {
                    foreach (AggregatedAccountInfo aggregatedAccountInfo in list)
                    {
                        bool   flag = false;
                        string aggregatedAccountEmail = SessionSettingsType.DecodeIdnDomain(aggregatedAccountInfo.SmtpAddress);
                        if (!string.IsNullOrWhiteSpace(aggregatedAccountEmail))
                        {
                            if (list2.Find((ConnectedAccountInfo account) => StringComparer.InvariantCultureIgnoreCase.Equals(account.EmailAddress, aggregatedAccountEmail)) != null)
                            {
                                break;
                            }
                            if (!flag)
                            {
                                list2.Add(new ConnectedAccountInfo
                                {
                                    SubscriptionGuid = aggregatedAccountInfo.RequestGuid,
                                    EmailAddress     = aggregatedAccountEmail,
                                    DisplayName      = aggregatedAccountEmail
                                });
                            }
                        }
                    }
                }
                this.connectedAccountInfos = list2.ToArray();
            }
            OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.IsDatacenterMode, countersCapture, true);
            this.helpUrl = helpUrlData.HelpUrl;
            this.isPublicComputerSession = UserContextUtilities.IsPublicComputerSession(callContext.HttpContext);
            string errorString = string.Empty;

            try
            {
                IMailboxInfo mailboxInfo = userContext.ExchangePrincipal.MailboxInfo;
                TenantPublicFolderConfiguration tenantPublicFolderConfiguration = null;
                if (TenantPublicFolderConfigurationCache.Instance.TryGetValue(mailboxInfo.OrganizationId, out tenantPublicFolderConfiguration))
                {
                    ADObjectId            defaultPublicFolderMailbox = userContext.ExchangePrincipal.DefaultPublicFolderMailbox;
                    PublicFolderRecipient publicFolderRecipient      = tenantPublicFolderConfiguration.GetPublicFolderRecipient(mailboxInfo.MailboxGuid, defaultPublicFolderMailbox);
                    if (publicFolderRecipient != null)
                    {
                        if (publicFolderRecipient.IsLocal)
                        {
                            this.DefaultPublicFolderMailbox = publicFolderRecipient.PrimarySmtpAddress.ToString();
                        }
                        else if (publicFolderRecipient.ObjectId == null)
                        {
                            errorString = "publicFolderRecipient not local and ObjectId null";
                        }
                        else
                        {
                            errorString = "publicFolderRecipient not local and ObjectId " + publicFolderRecipient.ObjectId.ObjectGuid;
                        }
                    }
                    else
                    {
                        errorString = "publicFolderRecipient null";
                    }
                }
            }
            catch (LocalizedException ex)
            {
                errorString = ex.ToString();
            }
            finally
            {
                OwaUserConfigurationLogUtilities.LogAndResetPerfCapture(OwaUserConfigurationLogType.DefaultPublicFolderMailbox, countersCapture, true, errorString);
            }
        }