public bool VerifyAgent(AgentCircuitData circuit)
 {
     if (circuit.ServiceURLs.ContainsKey ("HomeURI"))
     {
         string url = circuit.ServiceURLs["HomeURI"].ToString ();
         UserAgentServiceConnector security = new UserAgentServiceConnector (url);
         return security.VerifyAgent (circuit.SessionID, circuit.ServiceSessionID);
     }
     else
         MainConsole.Instance.DebugFormat ("[HG ENTITY TRANSFER MODULE]: Agent {0} {1} does not have a HomeURI OH NO!", circuit.firstname, circuit.lastname);
     return VerifyAgent (circuit.SessionID, circuit.ServiceSessionID);
 }
        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)
            {
                MainConsole.Instance.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);
            //                Object[] args = new Object[] { userURL };
            IUserAgentService userAgentService = new UserAgentServiceConnector (userURL);
            try
            {
                return userAgentService.VerifyAgent (aCircuit.SessionID, aCircuit.ServiceSessionID);
            }
            catch
            {
                MainConsole.Instance.DebugFormat ("[GATEKEEPER SERVICE]: Unable to contact authentication service at {0}", userURL);
                return false;
            }
        }