// Token: 0x0600073B RID: 1851 RVA: 0x0002A6F4 File Offset: 0x000288F4
        protected override AnchorMailbox ResolveAnchorMailbox()
        {
            if (ExTraceGlobals.VerboseTracer.IsTraceEnabled(1))
            {
                ExTraceGlobals.VerboseTracer.TraceDebug <string, Uri>((long)this.GetHashCode(), "[SiteMailboxCreatingProxyRequestHandler::ResolveAnchorMailbox]: Method {0}; Url {1};", base.ClientRequest.HttpMethod, base.ClientRequest.Url);
            }
            if (!Utilities.IsPartnerHostedOnly && !GlobalConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).MultiTenancy.Enabled)
            {
                base.Logger.Set(3, "SiteMailboxCreating-ServerVersion");
                return(new ServerVersionAnchorMailbox <EcpService>(new ServerVersion(Server.E15MinVersion), 0, this));
            }
            AnchorMailbox anchorMailbox = AnchorMailboxFactory.CreateFromCaller(this);

            if (anchorMailbox is AnonymousAnchorMailbox)
            {
                return(anchorMailbox);
            }
            if (anchorMailbox is DomainAnchorMailbox || anchorMailbox is OrganizationAnchorMailbox)
            {
                return(anchorMailbox);
            }
            SidAnchorMailbox sidAnchorMailbox = anchorMailbox as SidAnchorMailbox;

            if (sidAnchorMailbox != null)
            {
                if (sidAnchorMailbox.OrganizationId == null)
                {
                    throw new InvalidOperationException(string.Format("OrganizationId is null for site mailbox proxy {0}.", anchorMailbox.ToString()));
                }
                base.Logger.Set(3, "SiteMailboxCreating-Organization");
                return(new OrganizationAnchorMailbox(sidAnchorMailbox.OrganizationId, this));
            }
            else
            {
                UserBasedAnchorMailbox userBasedAnchorMailbox = anchorMailbox as UserBasedAnchorMailbox;
                if (userBasedAnchorMailbox == null)
                {
                    throw new InvalidOperationException(string.Format("Unknown site mailbox proxy {0}.", anchorMailbox.ToString()));
                }
                OrganizationId organizationId = (OrganizationId)userBasedAnchorMailbox.GetADRawEntry()[ADObjectSchema.OrganizationId];
                if (organizationId == null)
                {
                    throw new InvalidOperationException(string.Format("OrganizationId is null for site mailbox proxy {0}.", anchorMailbox.ToString()));
                }
                base.Logger.Set(3, "SiteMailboxCreating-Organization");
                return(new OrganizationAnchorMailbox(organizationId, this));
            }
        }
Exemple #2
0
 private void RedirectIfNeeded()
 {
     if (!this.IsSecurityTokenPresent())
     {
         UserBasedAnchorMailbox userBasedAnchorMailbox = AnchorMailboxFactory.CreateFromCaller(this) as UserBasedAnchorMailbox;
         if (userBasedAnchorMailbox != null)
         {
             ADRawEntry adrawEntry = userBasedAnchorMailbox.GetADRawEntry();
             ExTraceGlobals.VerboseTracer.TraceDebug <UserBasedAnchorMailbox, ExchangeObjectVersion>((long)this.GetHashCode(), "[RemotePowerShellProxyRequestHandler::RedirectIfNeeded] Redirect if the user is in E14 forest. User: {0}; ExchangeVersion: {1}", userBasedAnchorMailbox, adrawEntry.ExchangeVersion);
             if (adrawEntry.ExchangeVersion.IsOlderThan(ExchangeObjectVersion.Exchange2012))
             {
                 base.Logger.AppendGenericInfo("RedirectReason", "NoSecurityTokenAndOlderThanE15");
                 base.DatacenterRedirectStrategy.RedirectMailbox(userBasedAnchorMailbox);
             }
         }
     }
 }
        protected override AnchorMailbox ResolveAnchorMailbox()
        {
            string text = base.HttpContext.Items["destination"] as string;
            Uri    uri;

            if (!Uri.TryCreate(text, UriKind.Absolute, out uri))
            {
                throw new HttpException(400, "destination value is not valid");
            }
            string text2 = null;
            bool   flag2;
            string text3;
            bool   flag = FbaFormPostProxyRequestHandler.IsExplicitLogon(HttpRuntime.AppDomainAppVirtualPath, uri.PathAndQuery, uri.OriginalString, out flag2, out text2, out text3);

            if (flag)
            {
                this.explicitLogonUser = text2;
            }
            AnchorMailbox anchorMailbox;

            if (!string.IsNullOrEmpty(this.explicitLogonUser))
            {
                anchorMailbox = new SmtpAnchorMailbox(this.explicitLogonUser, this);
            }
            else
            {
                anchorMailbox = AnchorMailboxFactory.CreateFromCaller(this);
            }
            UserBasedAnchorMailbox userBasedAnchorMailbox = anchorMailbox as UserBasedAnchorMailbox;

            if (userBasedAnchorMailbox != null)
            {
                if (UrlUtilities.IsEacUrl(text))
                {
                    userBasedAnchorMailbox.CacheKeyPostfix = "_EAC";
                }
                else
                {
                    userBasedAnchorMailbox.MissingDatabaseHandler = new Func <ADRawEntry, ADObjectId>(base.ResolveMailboxDatabase);
                }
            }
            return(anchorMailbox);
        }
        // Token: 0x060004BD RID: 1213 RVA: 0x0001A12C File Offset: 0x0001832C
        protected override AnchorMailbox ResolveAnchorMailbox()
        {
            AnchorMailbox anchorMailbox = null;

            if (!base.HasPreemptivelyCheckedForRoutingHint)
            {
                anchorMailbox = base.CreateAnchorMailboxFromRoutingHint();
            }
            if (anchorMailbox != null)
            {
                return(anchorMailbox);
            }
            anchorMailbox = this.TryGetAnchorMailboxFromWsSecurityRequest();
            if (anchorMailbox != null)
            {
                return(anchorMailbox);
            }
            anchorMailbox = this.TryGetAnchorMailboxFromDomainBasedRequest();
            if (anchorMailbox != null)
            {
                return(anchorMailbox);
            }
            return(AnchorMailboxFactory.CreateFromCaller(this));
        }