Ejemplo n.º 1
0
 public virtual void Refresh(OwaIdentity identity)
 {
     if (identity.GetType() != base.GetType())
     {
         throw new OwaInvalidOperationException(string.Format("Type of passed in identity does not match current identity.  Expected {0} but got {1}.", base.GetType(), identity.GetType()));
     }
 }
Ejemplo n.º 2
0
        // Token: 0x06001394 RID: 5012 RVA: 0x00078990 File Offset: 0x00076B90
        public static SerializedClientSecurityContext CreateFromOwaIdentity(OwaIdentity owaIdentity)
        {
            SerializedClientSecurityContext serializedClientSecurityContext = new SerializedClientSecurityContext();

            owaIdentity.ClientSecurityContext.SetSecurityAccessToken(serializedClientSecurityContext);
            serializedClientSecurityContext.LogonName          = owaIdentity.GetLogonName();
            serializedClientSecurityContext.AuthenticationType = owaIdentity.AuthenticationType;
            return(serializedClientSecurityContext);
        }
Ejemplo n.º 3
0
        public override void Refresh(OwaIdentity identity)
        {
            if (identity == null)
            {
                throw new ArgumentNullException("identity");
            }
            base.Refresh(identity);
            OwaLiveIDIdentity owaLiveIDIdentity = identity as OwaLiveIDIdentity;

            if (owaLiveIDIdentity != null)
            {
                this.hasAcceptedAccruals = owaLiveIDIdentity.HasAcceptedAccruals;
            }
        }
        // Token: 0x06000FD4 RID: 4052 RVA: 0x000629F4 File Offset: 0x00060BF4
        public override bool IsEqualsTo(OwaIdentity otherIdentity)
        {
            if (otherIdentity == null)
            {
                return(false);
            }
            OwaMiniRecipientIdentity owaMiniRecipientIdentity = otherIdentity as OwaMiniRecipientIdentity;

            if (owaMiniRecipientIdentity == null)
            {
                throw new OwaInvalidOperationException("Comparing OwaMiniRecipientIdentity with identities of another type is not supported");
            }
            return(owaMiniRecipientIdentity.ProxyAddress == this.proxyAddress);
        }
Ejemplo n.º 5
0
        internal static void RecordUserContextCreation(OwaIdentity logonIdentity, UserContext userContext)
        {
            if (logonIdentity == null)
            {
                throw new ArgumentNullException("logonIdentity");
            }
            if (userContext == null)
            {
                throw new ArgumentNullException("userContext");
            }
            string userName = logonIdentity.UserSid.ToString();

            PerformanceCounterManager.UpdatePerfCounteronUserContextCreation(userName, userContext.IsProxy, userContext.IsBasicExperience, Globals.ArePerfCountersEnabled);
        }
Ejemplo n.º 6
0
        internal static OwaIdentity CreateOwaIdentityFromSmtpAddress(OwaIdentity logonIdentity, string smtpAddress, out ExchangePrincipal logonExchangePrincipal, out bool isExplicitLogon, out bool isAlternateMailbox)
        {
            OwaIdentity owaIdentity = null;

            isAlternateMailbox     = false;
            isExplicitLogon        = false;
            logonExchangePrincipal = null;
            try
            {
                logonExchangePrincipal = logonIdentity.CreateExchangePrincipal();
                Guid?alternateMailbox = OwaAlternateMailboxIdentity.GetAlternateMailbox(logonExchangePrincipal, smtpAddress);
                if (alternateMailbox != null)
                {
                    owaIdentity        = OwaAlternateMailboxIdentity.Create(logonIdentity, logonExchangePrincipal, alternateMailbox.Value);
                    isAlternateMailbox = true;
                    ExTraceGlobals.CoreTracer.TraceDebug <string>(0L, "The request is under alternate mailbox: {0}", smtpAddress);
                }
                else
                {
                    isExplicitLogon = true;
                }
            }
            catch (AdUserNotFoundException)
            {
                isExplicitLogon = true;
            }
            catch (UserHasNoMailboxException)
            {
                isExplicitLogon = true;
            }
            if (isExplicitLogon)
            {
                if (owaIdentity != null)
                {
                    owaIdentity.Dispose();
                    owaIdentity = null;
                }
                owaIdentity = OwaMiniRecipientIdentity.CreateFromProxyAddress(smtpAddress);
                ExTraceGlobals.CoreTracer.TraceDebug <string>(0L, "The request is under explicit logon: {0}", smtpAddress);
            }
            return(owaIdentity);
        }
Ejemplo n.º 7
0
        public IAsyncResult BeginProxyLanguagePostRequest(AsyncCallback callback, object extraData)
        {
            ExTraceGlobals.ProxyCallTracer.TraceDebug((long)this.GetHashCode(), "ProxyEventHandler.BeginProxyLanguagePostRequest");
            base.DontWriteHeaders = true;
            this.asyncResult      = new OwaAsyncResult(callback, extraData);
            if (base.UserContext != null)
            {
                int num;
                base.UserContext.DangerousBeginUnlockedAction(false, out num);
            }
            OwaIdentity identity        = (OwaIdentity)base.GetParameter("identity");
            string      timeZoneKeyName = (string)base.GetParameter("tzid");
            CultureInfo culture         = (CultureInfo)base.GetParameter("culture");
            bool        isOptimized     = (bool)base.GetParameter("opt");
            string      destination     = (string)base.GetParameter("destination");

            this.proxyLanguagePostRequest = new ProxyLanguagePostRequest();
            this.proxyLanguagePostRequest.BeginSend(base.OwaContext, this.OriginalRequest, identity, culture, timeZoneKeyName, isOptimized, destination, new AsyncCallback(this.SendLanguagePostCallback), this);
            return(this.asyncResult);
        }
        internal void BeginSend(OwaContext owaContext, HttpRequest originalRequest, OwaIdentity identity, CultureInfo culture, string timeZoneKeyName, bool isOptimized, string destination, AsyncCallback callback, object extraData)
        {
            ExTraceGlobals.ProxyCallTracer.TraceDebug((long)this.GetHashCode(), "ProxyLanguagePostRequest.BeginSend");
            StringWriter  stringWriter     = null;
            XmlTextWriter xmlTextWriter    = null;
            string        proxyRequestBody = null;

            try
            {
                stringWriter  = new StringWriter();
                xmlTextWriter = new XmlTextWriter(stringWriter);
                xmlTextWriter.WriteStartElement(ProxyLanguagePostRequest.rootElementName);
                xmlTextWriter.WriteAttributeString(ProxyLanguagePostRequest.localeIdAttributeName, culture.LCID.ToString());
                xmlTextWriter.WriteAttributeString(ProxyLanguagePostRequest.timeZoneKeyNameAttributeName, timeZoneKeyName);
                xmlTextWriter.WriteAttributeString(ProxyLanguagePostRequest.isOptimizedAttributeName, isOptimized ? "1" : "0");
                xmlTextWriter.WriteAttributeString(ProxyLanguagePostRequest.destinationAttributeName, destination);
                SerializedClientSecurityContext serializedClientSecurityContext = SerializedClientSecurityContext.CreateFromOwaIdentity(identity);
                serializedClientSecurityContext.Serialize(xmlTextWriter);
                xmlTextWriter.WriteEndElement();
                stringWriter.Flush();
                proxyRequestBody = stringWriter.ToString();
                ExTraceGlobals.ProxyDataTracer.TraceDebug <int, string, bool>((long)this.GetHashCode(), "Sending xml payload with lcid={0}, tzid={1}, isOptimized={2}", culture.LCID, timeZoneKeyName, isOptimized);
            }
            finally
            {
                if (stringWriter != null)
                {
                    stringWriter.Close();
                }
                if (xmlTextWriter != null)
                {
                    xmlTextWriter.Close();
                }
            }
            base.BeginSend(owaContext, originalRequest, OwaUrl.LanguagePost.GetExplicitUrl(originalRequest), proxyRequestBody, callback, extraData);
        }
Ejemplo n.º 9
0
 public virtual bool IsEqualsTo(OwaIdentity otherIdentity)
 {
     return(otherIdentity != null && otherIdentity.UserSid.Equals(this.UserSid));
 }
 internal static OwaAlternateMailboxIdentity Create(OwaIdentity logonIdentity, ExchangePrincipal logonExchangePrincipal, Guid aggregatedMailboxGuid)
 {
     return(new OwaAlternateMailboxIdentity(logonIdentity, logonExchangePrincipal, aggregatedMailboxGuid));
 }
 private OwaAlternateMailboxIdentity(OwaIdentity logonIdentity, ExchangePrincipal logonExchangePrincipal, Guid aggregatedMailboxGuid)
 {
     this.logonIdentity          = logonIdentity;
     this.logonExchangePrincipal = logonExchangePrincipal;
     this.aggregatedMailboxGuid  = aggregatedMailboxGuid;
 }
Ejemplo n.º 12
0
        private ExchangePrincipal GetExchangePrincipalFromWindowsIdentity(WindowsIdentity windowsIdentity, string smtpAddress)
        {
            OwaIdentity       owaIdentity  = OwaWindowsIdentity.CreateFromWindowsIdentity(windowsIdentity);
            OwaIdentity       owaIdentity2 = null;
            bool              flag         = false;
            bool              flag2        = false;
            ExchangePrincipal result;

            try
            {
                ExchangePrincipal exchangePrincipal = null;
                if (smtpAddress != null)
                {
                    owaIdentity2 = OwaIdentity.CreateOwaIdentityFromSmtpAddress(owaIdentity, smtpAddress, out exchangePrincipal, out flag, out flag2);
                }
                else
                {
                    owaIdentity2 = owaIdentity;
                }
                if (flag && owaIdentity2.IsPartial)
                {
                    OwaMiniRecipientIdentity owaMiniRecipientIdentity = owaIdentity2 as OwaMiniRecipientIdentity;
                    try
                    {
                        owaMiniRecipientIdentity.UpgradePartialIdentity();
                    }
                    catch (DataValidationException ex)
                    {
                        PropertyValidationError propertyValidationError = ex.Error as PropertyValidationError;
                        if (propertyValidationError == null || propertyValidationError.PropertyDefinition != MiniRecipientSchema.Languages)
                        {
                            return(null);
                        }
                        OWAMiniRecipient owaminiRecipient = owaIdentity2.FixCorruptOWAMiniRecipientCultureEntry();
                        if (owaminiRecipient != null)
                        {
                            owaIdentity2.Dispose();
                            owaIdentity2 = OwaMiniRecipientIdentity.CreateFromOWAMiniRecipient(owaminiRecipient);
                        }
                    }
                }
                if (owaIdentity == owaIdentity2 && exchangePrincipal != null)
                {
                    result = exchangePrincipal;
                }
                else
                {
                    try
                    {
                        result = owaIdentity2.InternalCreateExchangePrincipal();
                    }
                    catch (UserHasNoMailboxException)
                    {
                        result = null;
                    }
                }
            }
            finally
            {
                if (owaIdentity != owaIdentity2 && owaIdentity2 != null)
                {
                    owaIdentity2.Dispose();
                    owaIdentity2 = null;
                }
                if (owaIdentity != null)
                {
                    owaIdentity.Dispose();
                    owaIdentity = null;
                }
            }
            return(result);
        }
Ejemplo n.º 13
0
        internal static void RecordUserContextDeletion(OwaIdentity logonIdentity, UserContext userContext)
        {
            string userName = logonIdentity.UserSid.ToString();

            PerformanceCounterManager.UpdatePerfCounteronUserContextDeletion(userName, userContext.IsProxy, userContext.IsBasicExperience, Globals.ArePerfCountersEnabled);
        }