aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/HypergridService/GatekeeperService.cs
diff options
context:
space:
mode:
authorDiva Canto2010-01-17 18:04:55 -0800
committerDiva Canto2010-01-17 18:04:55 -0800
commitb2e6ec9e12ad07eb08496ebe8ca0476b793017d5 (patch)
treeac72f03b9cfca6f344d697f6d7581e5147ccf450 /OpenSim/Services/HypergridService/GatekeeperService.cs
parentOops, forgot this one. (diff)
downloadopensim-SC-b2e6ec9e12ad07eb08496ebe8ca0476b793017d5.zip
opensim-SC-b2e6ec9e12ad07eb08496ebe8ca0476b793017d5.tar.gz
opensim-SC-b2e6ec9e12ad07eb08496ebe8ca0476b793017d5.tar.bz2
opensim-SC-b2e6ec9e12ad07eb08496ebe8ca0476b793017d5.tar.xz
Agent gets there through the Gatekeeper, but still a few quirks to fix.
Diffstat (limited to 'OpenSim/Services/HypergridService/GatekeeperService.cs')
-rw-r--r--OpenSim/Services/HypergridService/GatekeeperService.cs68
1 files changed, 62 insertions, 6 deletions
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
164 return region; 164 return region;
165 } 165 }
166 166
167 public bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination) 167 public bool LoginAgent(AgentCircuitData aCircuit, GridRegion destination, out string reason)
168 { 168 {
169 reason = string.Empty;
170
169 string authURL = string.Empty; 171 string authURL = string.Empty;
170 if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) 172 if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
171 authURL = aCircuit.ServiceURLs["HomeURI"].ToString(); 173 authURL = aCircuit.ServiceURLs["HomeURI"].ToString();
172
173 m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to login foreign agent {0} {1} @ {2} ({3}) at destination {4}", 174 m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to login foreign agent {0} {1} @ {2} ({3}) at destination {4}",
174 aCircuit.firstname, aCircuit.lastname, authURL, aCircuit.AgentID, destination.RegionName); 175 aCircuit.firstname, aCircuit.lastname, authURL, aCircuit.AgentID, destination.RegionName);
175 176
176 if (!Authenticate(aCircuit)) 177 if (!Authenticate(aCircuit))
177 { 178 {
179 reason = "Unable to verify identity";
178 m_log.InfoFormat("[GATEKEEPER SERVICE]: Unable to verify identity of agent {0} {1}. Refusing service.", aCircuit.firstname, aCircuit.lastname); 180 m_log.InfoFormat("[GATEKEEPER SERVICE]: Unable to verify identity of agent {0} {1}. Refusing service.", aCircuit.firstname, aCircuit.lastname);
179 return false; 181 return false;
180 } 182 }
183 m_log.DebugFormat("[GATEKEEPER SERVICE]: Identity verified for {0} {1} @ {2}", aCircuit.firstname, aCircuit.lastname, authURL);
181 184
182 // Check to see if we have a local user with that UUID 185 // Check to see if we have a local user with that UUID
183 UserAccount account = m_UserAccountService.GetUserAccount(m_ScopeID, aCircuit.AgentID); 186 UserAccount account = m_UserAccountService.GetUserAccount(m_ScopeID, aCircuit.AgentID);
184 if (account != null) 187 if (account != null)
185 { 188 {
186 // No, sorry; go away 189 // No, sorry; go away
190 reason = "User identifier not allowed on this grid";
187 m_log.InfoFormat("[GATEKEEPER SERVICE]: Foreign agent {0} {1} has UUID of local user {3}. Refusing service.", 191 m_log.InfoFormat("[GATEKEEPER SERVICE]: Foreign agent {0} {1} has UUID of local user {3}. Refusing service.",
188 aCircuit.firstname, aCircuit.lastname, aCircuit.AgentID); 192 aCircuit.firstname, aCircuit.lastname, aCircuit.AgentID);
189 return false; 193 return false;
190 } 194 }
195 m_log.DebugFormat("[GATEKEEPER SERVICE]: User ID ok");
191 196
192 // May want to authorize 197 // May want to authorize
193 198
194 // Login the presence 199 // Login the presence
195 if (!m_PresenceService.LoginAgent(aCircuit.AgentID.ToString(), aCircuit.SessionID, aCircuit.SecureSessionID)) 200 if (!m_PresenceService.LoginAgent(aCircuit.AgentID.ToString(), aCircuit.SessionID, aCircuit.SecureSessionID))
196 { 201 {
202 reason = "Unable to login presence";
197 m_log.InfoFormat("[GATEKEEPER SERVICE]: Presence login failed for foreign agent {0} {1}. Refusing service.", 203 m_log.InfoFormat("[GATEKEEPER SERVICE]: Presence login failed for foreign agent {0} {1}. Refusing service.",
198 aCircuit.firstname, aCircuit.lastname); 204 aCircuit.firstname, aCircuit.lastname);
199 return false; 205 return false;
200 } 206 }
207 m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence ok");
208
209 // Get the region
210 destination = m_GridService.GetRegionByUUID(m_ScopeID, destination.RegionID);
211 if (destination == null)
212 {
213 reason = "Destination region not found";
214 return false;
215 }
216 m_log.DebugFormat("[GATEKEEPER SERVICE]: destination ok : {0}", destination.RegionName);
201 217
202 // Finally launch the agent at the destination 218 // Finally launch the agent at the destination
203 string reason = string.Empty;
204 aCircuit.firstname = aCircuit.firstname + "." + aCircuit.lastname; 219 aCircuit.firstname = aCircuit.firstname + "." + aCircuit.lastname;
205 aCircuit.lastname = "@" + aCircuit.ServiceURLs["HomeURI"].ToString(); 220 aCircuit.lastname = "@" + aCircuit.ServiceURLs["HomeURI"].ToString();
206 return m_SimulationService.CreateAgent(destination, aCircuit, 0, out reason); 221 return m_SimulationService.CreateAgent(destination, aCircuit, 0, out reason);
207 } 222 }
208 223
209 public bool LoginAttachments(ISceneObject sog, GridRegion destination) 224 public bool UpdateAgent(GridRegion destination, AgentData agent)
225 {
226 // Get the region
227 destination = m_GridService.GetRegionByUUID(m_ScopeID, destination.RegionID);
228 if (destination == null)
229 {
230 return false;
231 }
232
233 return m_SimulationService.UpdateAgent(destination, agent);
234 }
235
236 public bool LoginAttachment(GridRegion destination, ISceneObject sog)
210 { 237 {
238 // Get the region
239 destination = m_GridService.GetRegionByUUID(m_ScopeID, destination.RegionID);
240 if (destination == null)
241 {
242 return false;
243 }
244
211 // May want to filter attachments 245 // May want to filter attachments
212 return m_SimulationService.CreateObject(destination, sog, false); 246 return m_SimulationService.CreateObject(destination, sog, false);
213 } 247 }
214 248
249 public void ReleaseAgent(UUID regionID, UUID agentID)
250 {
251 GridRegion region = m_GridService.GetRegionByUUID(m_ScopeID, regionID);
252 if (region != null)
253 {
254 string uri = "http://" + region.ExternalHostName + ":" + region.HttpPort +
255 "/agent/" + agentID.ToString() + "/" + regionID.ToString() + "/release/";
256
257 m_SimulationService.ReleaseAgent(regionID, agentID, uri);
258 }
259 }
260
215 protected bool Authenticate(AgentCircuitData aCircuit) 261 protected bool Authenticate(AgentCircuitData aCircuit)
216 { 262 {
217 string authURL = string.Empty; 263 string authURL = string.Empty;
218 if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) 264 if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
219 authURL = aCircuit.ServiceURLs["HomeURI"].ToString(); 265 authURL = aCircuit.ServiceURLs["HomeURI"].ToString();
220 266
@@ -227,7 +273,17 @@ namespace OpenSim.Services.HypergridService
227 Object[] args = new Object[] { authURL }; 273 Object[] args = new Object[] { authURL };
228 IAuthenticationService authService = ServerUtils.LoadPlugin<IAuthenticationService>(m_AuthDll, args); 274 IAuthenticationService authService = ServerUtils.LoadPlugin<IAuthenticationService>(m_AuthDll, args);
229 if (authService != null) 275 if (authService != null)
230 return authService.Verify(aCircuit.AgentID, aCircuit.SecureSessionID.ToString(), 30); 276 {
277 try
278 {
279 return authService.Verify(aCircuit.AgentID, aCircuit.SecureSessionID.ToString(), 30);
280 }
281 catch
282 {
283 m_log.DebugFormat("[GATEKEEPER SERVICE]: Unable to contact authentication service at {0}", authURL);
284 return false;
285 }
286 }
231 287
232 return false; 288 return false;
233 } 289 }