コード例 #1
0
        // Token: 0x0600164D RID: 5709 RVA: 0x000832A8 File Offset: 0x000814A8
        internal static UserContextCookie TryCreateFromHttpCookie(HttpCookie cookie, string logonUniqueKey)
        {
            string text   = null;
            string text2  = null;
            string text3  = null;
            Canary canary = null;

            if (string.IsNullOrEmpty(cookie.Value))
            {
                ExTraceGlobals.UserContextTracer.TraceDebug <string, string, string>(21L, "Http cookie value is null, Name={0}, Domain={1}, Path={2}", cookie.Name, cookie.Domain, cookie.Path);
            }
            else if (!UserContextCookie.TryParseCookieValue(cookie.Value, out text, out text2))
            {
                ExTraceGlobals.UserContextTracer.TraceDebug(21L, "TryParseCookeValue failed, Name={0}, Domain={1}, Path={2}, Value={3}", new object[]
                {
                    cookie.Name,
                    cookie.Domain,
                    cookie.Path,
                    cookie.Value
                });
            }
            else
            {
                if (!UserContextCookie.TryParseCookieName(cookie.Name, out text3))
                {
                    ExTraceGlobals.UserContextTracer.TraceDebug(21L, "TryParseCookieName failed, Name={0}, Domain={1}, Path={2}, vVlue={3}, canaryString={4}, mailboxUniqueKey={5}", new object[]
                    {
                        cookie.Name,
                        cookie.Domain,
                        cookie.Path,
                        cookie.Value,
                        text,
                        text2
                    });
                }
                canary = Canary.RestoreCanary(text, logonUniqueKey);
            }
            if (canary == null)
            {
                ExTraceGlobals.UserContextTracer.TraceDebug(21L, "restoredCanary==null, Name={0}, Domain={1}, Path={2}, Value={3}, canaryString={4}, mailboxUniqueKey={5}, logonUniqueKey={6}", new object[]
                {
                    cookie.Name,
                    cookie.Domain,
                    cookie.Path,
                    cookie.Value,
                    text,
                    text2,
                    logonUniqueKey
                });
                canary = new Canary(Guid.NewGuid(), logonUniqueKey);
                ExTraceGlobals.UserContextTracer.TraceDebug <string, string, string>(21L, "Canary is recreated, userContextId={0}, logonUniqueKey={1}, canaryString={2}", canary.UserContextId, canary.LogonUniqueKey, canary.ToString());
            }
            return(UserContextCookie.Create(text3, canary, text2));
        }
コード例 #2
0
        // Token: 0x06001657 RID: 5719 RVA: 0x000836D4 File Offset: 0x000818D4
        internal static UserContextCookie GetUserContextCookie(OwaContext owaContext)
        {
            HttpRequest request = owaContext.HttpContext.Request;

            for (int i = 0; i < request.Cookies.Count; i++)
            {
                HttpCookie httpCookie = request.Cookies[i];
                if (httpCookie.Name != null && httpCookie.Name.StartsWith("UserContext", StringComparison.OrdinalIgnoreCase))
                {
                    UserContextCookie userContextCookie = UserContextCookie.TryCreateFromHttpCookie(httpCookie, owaContext.LogonIdentity.UniqueId);
                    if (userContextCookie == null)
                    {
                        ExTraceGlobals.UserContextTracer.TraceDebug(24L, "Invalid user context cookie received. Cookie value={0}, logonIdentity={1}, owaContext.MailboxIdentity.UniqueId={2}, owaContext.IsDifferentMailbox={3}", new object[]
                        {
                            httpCookie.Value,
                            owaContext.LogonIdentity.UniqueId,
                            owaContext.MailboxIdentity.UniqueId,
                            owaContext.IsDifferentMailbox
                        });
                        throw new OwaInvalidRequestException("Invalid user context cookie received. Cookie value:" + httpCookie.Value + " logonIdentity:" + owaContext.LogonIdentity.UniqueId);
                    }
                    if (userContextCookie.MailboxUniqueKey == null)
                    {
                        if (!owaContext.IsDifferentMailbox)
                        {
                            return(userContextCookie);
                        }
                    }
                    else if (string.Equals(userContextCookie.MailboxUniqueKey, owaContext.MailboxIdentity.UniqueId, StringComparison.Ordinal))
                    {
                        return(userContextCookie);
                    }
                    ExTraceGlobals.UserContextTracer.TraceDebug <string, string, bool>(24L, "currentCookie.MailboxUniqueKey={0}, owaContext.MailboxIdentity.UniqueId={1}, owaContext.IsDifferentMailbox={2}", userContextCookie.MailboxUniqueKey, owaContext.MailboxIdentity.UniqueId, owaContext.IsDifferentMailbox);
                }
            }
            return(null);
        }
コード例 #3
0
 internal static UserContextKey CreateFromCookie(UserContextCookie userContextCookie)
 {
     return(new UserContextKey(userContextCookie.ContextCanary, userContextCookie.MailboxUniqueKey));
 }
コード例 #4
0
 // Token: 0x06000EE5 RID: 3813 RVA: 0x0005E488 File Offset: 0x0005C688
 public OwaInvalidCanary14Exception(UserContextCookie newUserContextCookie, string message = null) : base(message)
 {
     this.userContextCookie = newUserContextCookie;
 }