private static Uri FindRedirectOwaUrlCrossSite(Site targetSite, int expectedMajorVersion, AuthenticationMethod internalAutheticationMethod, AuthenticationMethod externalAuthenticationMethod, BackEndServer backEndServer, out bool isSameAuthMethod, out FbaFormPostProxyRequestHandler.LegacyRedirectFailureCause failureCause)
        {
            failureCause     = FbaFormPostProxyRequestHandler.LegacyRedirectFailureCause.None;
            isSameAuthMethod = false;
            bool            isSameAuthExternalService = false;
            OwaService      clientExternalService     = null;
            ServiceTopology currentServiceTopology    = ServiceTopology.GetCurrentServiceTopology("f:\\15.00.1497\\sources\\dev\\cafe\\src\\HttpProxy\\RequestHandlers\\FbaFormPostProxyRequestHandler.cs", "FindRedirectOwaUrlCrossSite", 390);
            string          mailboxServerFQDN         = backEndServer.Fqdn;

            new List <OwaService>();
            currentServiceTopology.ForEach <OwaService>(delegate(OwaService owaService)
            {
                if (ServiceTopology.IsOnSite(owaService, targetSite, "f:\\15.00.1497\\sources\\dev\\cafe\\src\\HttpProxy\\RequestHandlers\\FbaFormPostProxyRequestHandler.cs", "FindRedirectOwaUrlCrossSite", 401) && owaService.ClientAccessType == ClientAccessType.External)
                {
                    int major = OwaServerVersion.CreateFromVersionNumber(owaService.ServerVersionNumber).Major;
                    if (major == expectedMajorVersion)
                    {
                        bool flag = false;
                        if (owaService.AuthenticationMethod == internalAutheticationMethod || ((internalAutheticationMethod & AuthenticationMethod.Fba) != AuthenticationMethod.None && (owaService.AuthenticationMethod & AuthenticationMethod.Fba) != AuthenticationMethod.None))
                        {
                            flag = true;
                            if (!isSameAuthExternalService)
                            {
                                clientExternalService     = null;
                                isSameAuthExternalService = true;
                            }
                        }
                        if (flag || !isSameAuthExternalService)
                        {
                            if (clientExternalService == null)
                            {
                                clientExternalService = owaService;
                                return;
                            }
                            if (ServiceTopology.CasMbxServicesFirst(owaService, clientExternalService, mailboxServerFQDN, "f:\\15.00.1497\\sources\\dev\\cafe\\src\\HttpProxy\\RequestHandlers\\FbaFormPostProxyRequestHandler.cs", "FindRedirectOwaUrlCrossSite", 432) < 0)
                            {
                                clientExternalService = owaService;
                            }
                        }
                    }
                }
            }, "f:\\15.00.1497\\sources\\dev\\cafe\\src\\HttpProxy\\RequestHandlers\\FbaFormPostProxyRequestHandler.cs", "FindRedirectOwaUrlCrossSite", 396);
            if (clientExternalService != null)
            {
                isSameAuthMethod = isSameAuthExternalService;
                return(clientExternalService.Url);
            }
            failureCause = FbaFormPostProxyRequestHandler.LegacyRedirectFailureCause.NoCasFound;
            return(null);
        }
        // Token: 0x06000554 RID: 1364 RVA: 0x0001D684 File Offset: 0x0001B884
        private static Uri FindRedirectEcpUrlCrossSite(Site targetSite, int expectedMajorVersion, out FbaFormPostProxyRequestHandler.LegacyRedirectFailureCause failureCause)
        {
            failureCause = FbaFormPostProxyRequestHandler.LegacyRedirectFailureCause.None;
            EcpService clientExternalService = null;

            ServiceTopology.GetCurrentServiceTopology("d:\\dbs\\sh\\e16df\\0212_214120_0\\cmd\\1g\\sources\\Dev\\Cafe\\src\\HttpProxy\\RequestHandlers\\FbaFormPostProxyRequestHandler.cs", "FindRedirectEcpUrlCrossSite", 471).ForEach <EcpService>(delegate(EcpService ecpService)
            {
                if (ServiceTopology.IsOnSite(ecpService, targetSite, "d:\\dbs\\sh\\e16df\\0212_214120_0\\cmd\\1g\\sources\\Dev\\Cafe\\src\\HttpProxy\\RequestHandlers\\FbaFormPostProxyRequestHandler.cs", "FindRedirectEcpUrlCrossSite", 477) && ecpService.ClientAccessType == 1 && OwaServerVersion.CreateFromVersionNumber(ecpService.ServerVersionNumber).Major == expectedMajorVersion)
                {
                    clientExternalService = ecpService;
                }
            }, "d:\\dbs\\sh\\e16df\\0212_214120_0\\cmd\\1g\\sources\\Dev\\Cafe\\src\\HttpProxy\\RequestHandlers\\FbaFormPostProxyRequestHandler.cs", "FindRedirectEcpUrlCrossSite", 474);
            if (clientExternalService != null)
            {
                return(clientExternalService.Url);
            }
            failureCause = FbaFormPostProxyRequestHandler.LegacyRedirectFailureCause.NoCasFound;
            return(null);
        }
        private static Uri FindRedirectEcpUrlCrossSite(Site targetSite, int expectedMajorVersion, out FbaFormPostProxyRequestHandler.LegacyRedirectFailureCause failureCause)
        {
            failureCause = FbaFormPostProxyRequestHandler.LegacyRedirectFailureCause.None;
            EcpService      clientExternalService  = null;
            ServiceTopology currentServiceTopology = ServiceTopology.GetCurrentServiceTopology("f:\\15.00.1497\\sources\\dev\\cafe\\src\\HttpProxy\\RequestHandlers\\FbaFormPostProxyRequestHandler.cs", "FindRedirectEcpUrlCrossSite", 470);

            currentServiceTopology.ForEach <EcpService>(delegate(EcpService ecpService)
            {
                if (ServiceTopology.IsOnSite(ecpService, targetSite, "f:\\15.00.1497\\sources\\dev\\cafe\\src\\HttpProxy\\RequestHandlers\\FbaFormPostProxyRequestHandler.cs", "FindRedirectEcpUrlCrossSite", 476) && ecpService.ClientAccessType == ClientAccessType.External)
                {
                    int major = OwaServerVersion.CreateFromVersionNumber(ecpService.ServerVersionNumber).Major;
                    if (major == expectedMajorVersion)
                    {
                        clientExternalService = ecpService;
                    }
                }
            }, "f:\\15.00.1497\\sources\\dev\\cafe\\src\\HttpProxy\\RequestHandlers\\FbaFormPostProxyRequestHandler.cs", "FindRedirectEcpUrlCrossSite", 473);
            if (clientExternalService != null)
            {
                return(clientExternalService.Url);
            }
            failureCause = FbaFormPostProxyRequestHandler.LegacyRedirectFailureCause.NoCasFound;
            return(null);
        }
        // Token: 0x06000556 RID: 1366 RVA: 0x0001D77C File Offset: 0x0001B97C
        private static Uri FindRedirectOwaUrlOnSiteForMismatchVersion(Site targetSite, int expectedMajorVersion, AuthenticationMethod internalAutheticationMethod, AuthenticationMethod externalAuthenticationMethod, BackEndServer backEndServer, out bool isSameAuthMethod, out FbaFormPostProxyRequestHandler.LegacyRedirectFailureCause failureCause)
        {
            failureCause     = FbaFormPostProxyRequestHandler.LegacyRedirectFailureCause.None;
            isSameAuthMethod = true;
            bool            isSameAuthInternalService = false;
            bool            isSameAuthExternalService = false;
            OwaService      clientInternalService     = null;
            OwaService      clientExternalService     = null;
            string          mailboxServerFQDN         = backEndServer.Fqdn;
            ServiceTopology currentServiceTopology    = ServiceTopology.GetCurrentServiceTopology("d:\\dbs\\sh\\e16df\\0212_214120_0\\cmd\\1g\\sources\\Dev\\Cafe\\src\\HttpProxy\\RequestHandlers\\FbaFormPostProxyRequestHandler.cs", "FindRedirectOwaUrlOnSiteForMismatchVersion", 578);

            new List <OwaService>();
            currentServiceTopology.ForEach <OwaService>(delegate(OwaService owaService)
            {
                if (ServiceTopology.IsOnSite(owaService, targetSite, "d:\\dbs\\sh\\e16df\\0212_214120_0\\cmd\\1g\\sources\\Dev\\Cafe\\src\\HttpProxy\\RequestHandlers\\FbaFormPostProxyRequestHandler.cs", "FindRedirectOwaUrlOnSiteForMismatchVersion", 587))
                {
                    if (owaService.ClientAccessType == 1)
                    {
                        if (OwaServerVersion.CreateFromVersionNumber(owaService.ServerVersionNumber).Major == expectedMajorVersion)
                        {
                            bool flag = false;
                            if (owaService.AuthenticationMethod == internalAutheticationMethod || ((internalAutheticationMethod & 4) != null && (owaService.AuthenticationMethod & 4) != null))
                            {
                                flag = true;
                                if (!isSameAuthExternalService)
                                {
                                    clientExternalService     = null;
                                    isSameAuthExternalService = true;
                                }
                            }
                            if (flag || !isSameAuthExternalService)
                            {
                                if (clientExternalService == null)
                                {
                                    clientExternalService = owaService;
                                    return;
                                }
                                if (ServiceTopology.CasMbxServicesFirst(owaService, clientExternalService, mailboxServerFQDN, "d:\\dbs\\sh\\e16df\\0212_214120_0\\cmd\\1g\\sources\\Dev\\Cafe\\src\\HttpProxy\\RequestHandlers\\FbaFormPostProxyRequestHandler.cs", "FindRedirectOwaUrlOnSiteForMismatchVersion", 618) < 0)
                                {
                                    clientExternalService = owaService;
                                    return;
                                }
                            }
                        }
                    }
                    else if (owaService.ClientAccessType == null && OwaServerVersion.CreateFromVersionNumber(owaService.ServerVersionNumber).Major == expectedMajorVersion && clientExternalService == null)
                    {
                        bool flag = false;
                        if (owaService.AuthenticationMethod == internalAutheticationMethod || ((internalAutheticationMethod & 4) != null && (owaService.AuthenticationMethod & 4) != null))
                        {
                            flag = true;
                            if (!isSameAuthInternalService)
                            {
                                clientInternalService     = null;
                                isSameAuthInternalService = true;
                            }
                        }
                        if (flag || !isSameAuthInternalService)
                        {
                            if (clientInternalService == null)
                            {
                                clientInternalService = owaService;
                                return;
                            }
                            if (ServiceTopology.CasMbxServicesFirst(owaService, clientInternalService, mailboxServerFQDN, "d:\\dbs\\sh\\e16df\\0212_214120_0\\cmd\\1g\\sources\\Dev\\Cafe\\src\\HttpProxy\\RequestHandlers\\FbaFormPostProxyRequestHandler.cs", "FindRedirectOwaUrlOnSiteForMismatchVersion", 657) > 0)
                            {
                                clientInternalService = owaService;
                            }
                        }
                    }
                }
            }, "d:\\dbs\\sh\\e16df\\0212_214120_0\\cmd\\1g\\sources\\Dev\\Cafe\\src\\HttpProxy\\RequestHandlers\\FbaFormPostProxyRequestHandler.cs", "FindRedirectOwaUrlOnSiteForMismatchVersion", 582);
            if (clientExternalService != null)
            {
                isSameAuthMethod = isSameAuthExternalService;
                return(clientExternalService.Url);
            }
            if (clientInternalService != null)
            {
                isSameAuthMethod = isSameAuthInternalService;
                return(clientInternalService.Url);
            }
            failureCause = FbaFormPostProxyRequestHandler.LegacyRedirectFailureCause.NoCasFound;
            return(null);
        }