Пример #1
0
        protected virtual void DoLoad(OwaIdentity logonIdentity, OwaIdentity mailboxIdentity, UserContextStatistics stats)
        {
            if (logonIdentity == null)
            {
                throw new ArgumentNullException("logonIdentity");
            }
            this.logonIdentity = logonIdentity;
            if (mailboxIdentity != null)
            {
                this.isExplicitLogon = true;
                this.mailboxIdentity = mailboxIdentity;
            }
            else
            {
                this.mailboxIdentity = logonIdentity;
            }
            if (this.IsExplicitLogon)
            {
                ExTraceGlobals.CoreTracer.TraceDebug <string>(0L, "Created partial mailbox identity from SMTP address={0}", mailboxIdentity.SafeGetRenderableName());
                OwaMiniRecipientIdentity owaMiniRecipientIdentity = this.mailboxIdentity as OwaMiniRecipientIdentity;
                try
                {
                    owaMiniRecipientIdentity.UpgradePartialIdentity();
                }
                catch (DataValidationException ex)
                {
                    PropertyValidationError propertyValidationError = ex.Error as PropertyValidationError;
                    if (propertyValidationError == null || propertyValidationError.PropertyDefinition != MiniRecipientSchema.Languages)
                    {
                        throw;
                    }
                    OWAMiniRecipient owaminiRecipient = this.MailboxIdentity.FixCorruptOWAMiniRecipientCultureEntry();
                    if (owaminiRecipient != null)
                    {
                        this.mailboxIdentity = OwaMiniRecipientIdentity.CreateFromOWAMiniRecipient(owaminiRecipient);
                    }
                }
            }
            Stopwatch stopwatch = Stopwatch.StartNew();

            this.exchangePrincipal = this.mailboxIdentity.CreateExchangePrincipal();
            stats.ExchangePrincipalCreationTime = (int)stopwatch.ElapsedMilliseconds;
            this.LogTrace("UserContextBase.Load", "CreateExchangePrincipal finished");
            this.pendingRequestManager = new PendingRequestManager(this, ListenerChannelsManager.Instance);
        }
Пример #2
0
        internal static UserContextKey CreateNew(OwaIdentity logonIdentity, OwaIdentity mailboxIdentity, HttpContext httpContext)
        {
            if (logonIdentity == null)
            {
                throw new ArgumentNullException("logonIdentity");
            }
            string        uniqueId      = logonIdentity.UniqueId;
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendFormat("userContextLogonIdentityName=<PII>{0}</PII>", logonIdentity.SafeGetRenderableName());
            if (logonIdentity.UserSid != null)
            {
                stringBuilder.AppendFormat("userContextLogonIdentitySid=<PII>{0}</PII>", logonIdentity.UserSid.ToString());
            }
            string text = null;

            if (mailboxIdentity != null)
            {
                text = mailboxIdentity.UniqueId;
                stringBuilder.AppendFormat("userContextMbIdentityName=<PII>{0}</PII>", mailboxIdentity.SafeGetRenderableName());
                if (mailboxIdentity.UserSid != null)
                {
                    stringBuilder.AppendFormat("userContextMbIdentitySid=<PII>{0}</PII>", mailboxIdentity.UserSid.ToString());
                }
            }
            try
            {
                string text2 = stringBuilder.ToString();
                if (LiveIdAuthenticationModule.IdentityTracingEnabled && !string.IsNullOrWhiteSpace(text2))
                {
                    httpContext.Response.AppendToLog(text2);
                }
            }
            catch (Exception)
            {
            }
            return(UserContextKey.Create(UserContextUtilities.GetNewGuid(), uniqueId, text));
        }