protected bool Authenticate(AgentCircuitData aCircuit, out string message)
        {
            message = "";
            if (!CheckAddress(aCircuit.ServiceSessionID))
            {
                message = "Please use " + m_Uri.GetLeftPart(UriPartial.Authority) + " instead.";
                return(false);
            }

            if (string.IsNullOrEmpty(aCircuit.IPAddress))
            {
                m_log.DebugFormat("[GATEKEEPER SERVICE]: Agent did not provide a client IP address.");
                return(false);
            }

            string userURL = string.Empty;

            if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
            {
                userURL = aCircuit.ServiceURLs["HomeURI"].ToString();
            }

            if (userURL == string.Empty)
            {
                m_log.DebugFormat("[GATEKEEPER SERVICE]: Agent did not provide an authentication server URL");
                message = "Agent did not provide an authentication server URL.";
                return(false);
            }

            if (userURL == m_ExternalName)
            {
                return(m_UserAgentService.VerifyAgent(aCircuit.SessionID, aCircuit.ServiceSessionID));
            }
            else
            {
                IUserAgentService userAgentService = new UserAgentServiceConnector(userURL);

                try
                {
                    return(userAgentService.VerifyAgent(aCircuit.SessionID, aCircuit.ServiceSessionID));
                }
                catch
                {
                    m_log.DebugFormat("[GATEKEEPER SERVICE]: Unable to contact authentication service at {0}", userURL);
                    message = string.Format("Unable to contact authentication service at {0}.", userURL);
                    return(false);
                }
            }
        }
예제 #2
0
        protected bool Authenticate(AgentCircuitData aCircuit)
        {
            if (!CheckAddress(aCircuit.ServiceSessionID))
            {
                return(false);
            }

            if (string.IsNullOrEmpty(aCircuit.IPAddress))
            {
                m_log.DebugFormat("[GATEKEEPER SERVICE]: Agent did not provide a client IP address.");
                return(false);
            }

            string userURL = string.Empty;

            if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
            {
                userURL = aCircuit.ServiceURLs["HomeURI"].ToString();
            }

            OSHHTPHost userHomeHost = new OSHHTPHost(userURL, true);

            if (!userHomeHost.IsResolvedHost)
            {
                m_log.DebugFormat("[GATEKEEPER SERVICE]: Agent did not provide an authentication server URL");
                return(false);
            }

            if (m_gatekeeperHost.Equals(userHomeHost))
            {
                return(m_UserAgentService.VerifyAgent(aCircuit.SessionID, aCircuit.ServiceSessionID));
            }
            else
            {
                IUserAgentService userAgentService = new UserAgentServiceConnector(userURL);

                try
                {
                    return(userAgentService.VerifyAgent(aCircuit.SessionID, aCircuit.ServiceSessionID));
                }
                catch
                {
                    m_log.DebugFormat("[GATEKEEPER SERVICE]: Unable to contact authentication service at {0}", userURL);
                    return(false);
                }
            }
        }
예제 #3
0
        protected bool Authenticate(AgentCircuitData aCircuit)
        {
            if (!CheckAddress(aCircuit.ServiceSessionID))
            {
                return(false);
            }

            string userURL = string.Empty;

            if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
            {
                userURL = aCircuit.ServiceURLs["HomeURI"].ToString();
            }

            if (userURL == string.Empty)
            {
                m_log.DebugFormat("[GATEKEEPER SERVICE]: Agent did not provide an authentication server URL");
                return(false);
            }

            if (userURL == m_ExternalName)
            {
                return(m_UserAgentService.VerifyAgent(aCircuit.SessionID, aCircuit.ServiceSessionID));
            }
            else
            {
//                Object[] args = new Object[] { userURL };
                IUserAgentService userAgentService = new UserAgentServiceConnector(userURL);
                if (userAgentService != null)
                {
                    try
                    {
                        return(userAgentService.VerifyAgent(aCircuit.SessionID, aCircuit.ServiceSessionID));
                    }
                    catch
                    {
                        m_log.DebugFormat("[GATEKEEPER SERVICE]: Unable to contact authentication service at {0}", userURL);
                        return(false);
                    }
                }
            }

            return(false);
        }