From b2e6ec9e12ad07eb08496ebe8ca0476b793017d5 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 17 Jan 2010 18:04:55 -0800 Subject: Agent gets there through the Gatekeeper, but still a few quirks to fix. --- .../Services/HypergridService/GatekeeperService.cs | 68 ++++++++++++++++++++-- 1 file changed, 62 insertions(+), 6 deletions(-) (limited to 'OpenSim/Services/HypergridService/GatekeeperService.cs') diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index a5bd881..416e443 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -164,57 +164,103 @@ namespace OpenSim.Services.HypergridService return region; } - public bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination) + public bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination, out string reason) { + reason = string.Empty; + string authURL = string.Empty; if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) authURL = aCircuit.ServiceURLs["HomeURI"].ToString(); - m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to login foreign agent {0} {1} @ {2} ({3}) at destination {4}", aCircuit.firstname, aCircuit.lastname, authURL, aCircuit.AgentID, destination.RegionName); if (!Authenticate(aCircuit)) { + reason = "Unable to verify identity"; m_log.InfoFormat("[GATEKEEPER SERVICE]: Unable to verify identity of agent {0} {1}. Refusing service.", aCircuit.firstname, aCircuit.lastname); return false; } + m_log.DebugFormat("[GATEKEEPER SERVICE]: Identity verified for {0} {1} @ {2}", aCircuit.firstname, aCircuit.lastname, authURL); // Check to see if we have a local user with that UUID UserAccount account = m_UserAccountService.GetUserAccount(m_ScopeID, aCircuit.AgentID); if (account != null) { // No, sorry; go away + reason = "User identifier not allowed on this grid"; m_log.InfoFormat("[GATEKEEPER SERVICE]: Foreign agent {0} {1} has UUID of local user {3}. Refusing service.", aCircuit.firstname, aCircuit.lastname, aCircuit.AgentID); return false; } + m_log.DebugFormat("[GATEKEEPER SERVICE]: User ID ok"); // May want to authorize // Login the presence if (!m_PresenceService.LoginAgent(aCircuit.AgentID.ToString(), aCircuit.SessionID, aCircuit.SecureSessionID)) { + reason = "Unable to login presence"; m_log.InfoFormat("[GATEKEEPER SERVICE]: Presence login failed for foreign agent {0} {1}. Refusing service.", aCircuit.firstname, aCircuit.lastname); return false; } + m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence ok"); + + // Get the region + destination = m_GridService.GetRegionByUUID(m_ScopeID, destination.RegionID); + if (destination == null) + { + reason = "Destination region not found"; + return false; + } + m_log.DebugFormat("[GATEKEEPER SERVICE]: destination ok : {0}", destination.RegionName); // Finally launch the agent at the destination - string reason = string.Empty; aCircuit.firstname = aCircuit.firstname + "." + aCircuit.lastname; aCircuit.lastname = "@" + aCircuit.ServiceURLs["HomeURI"].ToString(); return m_SimulationService.CreateAgent(destination, aCircuit, 0, out reason); } - public bool LoginAttachments(ISceneObject sog, GridRegion destination) + public bool UpdateAgent(GridRegion destination, AgentData agent) + { + // Get the region + destination = m_GridService.GetRegionByUUID(m_ScopeID, destination.RegionID); + if (destination == null) + { + return false; + } + + return m_SimulationService.UpdateAgent(destination, agent); + } + + public bool LoginAttachment(GridRegion destination, ISceneObject sog) { + // Get the region + destination = m_GridService.GetRegionByUUID(m_ScopeID, destination.RegionID); + if (destination == null) + { + return false; + } + // May want to filter attachments return m_SimulationService.CreateObject(destination, sog, false); } + public void ReleaseAgent(UUID regionID, UUID agentID) + { + GridRegion region = m_GridService.GetRegionByUUID(m_ScopeID, regionID); + if (region != null) + { + string uri = "http://" + region.ExternalHostName + ":" + region.HttpPort + + "/agent/" + agentID.ToString() + "/" + regionID.ToString() + "/release/"; + + m_SimulationService.ReleaseAgent(regionID, agentID, uri); + } + } + protected bool Authenticate(AgentCircuitData aCircuit) { - string authURL = string.Empty; + string authURL = string.Empty; if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) authURL = aCircuit.ServiceURLs["HomeURI"].ToString(); @@ -227,7 +273,17 @@ namespace OpenSim.Services.HypergridService Object[] args = new Object[] { authURL }; IAuthenticationService authService = ServerUtils.LoadPlugin(m_AuthDll, args); if (authService != null) - return authService.Verify(aCircuit.AgentID, aCircuit.SecureSessionID.ToString(), 30); + { + try + { + return authService.Verify(aCircuit.AgentID, aCircuit.SecureSessionID.ToString(), 30); + } + catch + { + m_log.DebugFormat("[GATEKEEPER SERVICE]: Unable to contact authentication service at {0}", authURL); + return false; + } + } return false; } -- cgit v1.1