internal static UserContextKey CreateNew(SecurityIdentifier sid)
        {
            string text  = null;
            string text2 = sid.ToString();

            return(UserContextKey.Create(UserContextUtilities.GetNewGuid(), text2, text));
        }
        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));
        }