UserAgentService.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSimulator Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. using System;
  28. using System.Collections.Generic;
  29. using System.Net;
  30. using System.Reflection;
  31. using OpenSim.Framework;
  32. using OpenSim.Services.Connectors.Friends;
  33. using OpenSim.Services.Connectors.Hypergrid;
  34. using OpenSim.Services.Interfaces;
  35. using GridRegion = OpenSim.Services.Interfaces.GridRegion;
  36. using OpenSim.Server.Base;
  37. using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
  38. using OpenMetaverse;
  39. using log4net;
  40. using Nini.Config;
  41. namespace OpenSim.Services.HypergridService
  42. {
  43. /// <summary>
  44. /// This service is for HG1.5 only, to make up for the fact that clients don't
  45. /// keep any private information in themselves, and that their 'home service'
  46. /// needs to do it for them.
  47. /// Once we have better clients, this shouldn't be needed.
  48. /// </summary>
  49. public class UserAgentService : IUserAgentService
  50. {
  51. private static readonly ILog m_log =
  52. LogManager.GetLogger(
  53. MethodBase.GetCurrentMethod().DeclaringType);
  54. // This will need to go into a DB table
  55. static Dictionary<UUID, TravelingAgentInfo> m_TravelingAgents = new Dictionary<UUID, TravelingAgentInfo>();
  56. static bool m_Initialized = false;
  57. protected static IGridUserService m_GridUserService;
  58. protected static IGridService m_GridService;
  59. protected static GatekeeperServiceConnector m_GatekeeperConnector;
  60. protected static IGatekeeperService m_GatekeeperService;
  61. protected static IFriendsService m_FriendsService;
  62. protected static IPresenceService m_PresenceService;
  63. protected static IUserAccountService m_UserAccountService;
  64. protected static IFriendsSimConnector m_FriendsLocalSimConnector; // standalone, points to HGFriendsModule
  65. protected static FriendsSimConnector m_FriendsSimConnector; // grid
  66. protected static string m_GridName;
  67. protected static bool m_BypassClientVerification;
  68. public UserAgentService(IConfigSource config) : this(config, null)
  69. {
  70. }
  71. public UserAgentService(IConfigSource config, IFriendsSimConnector friendsConnector)
  72. {
  73. // Let's set this always, because we don't know the sequence
  74. // of instantiations
  75. if (friendsConnector != null)
  76. m_FriendsLocalSimConnector = friendsConnector;
  77. if (!m_Initialized)
  78. {
  79. m_Initialized = true;
  80. m_log.DebugFormat("[HOME USERS SECURITY]: Starting...");
  81. m_FriendsSimConnector = new FriendsSimConnector();
  82. IConfig serverConfig = config.Configs["UserAgentService"];
  83. if (serverConfig == null)
  84. throw new Exception(String.Format("No section UserAgentService in config file"));
  85. string gridService = serverConfig.GetString("GridService", String.Empty);
  86. string gridUserService = serverConfig.GetString("GridUserService", String.Empty);
  87. string gatekeeperService = serverConfig.GetString("GatekeeperService", String.Empty);
  88. string friendsService = serverConfig.GetString("FriendsService", String.Empty);
  89. string presenceService = serverConfig.GetString("PresenceService", String.Empty);
  90. string userAccountService = serverConfig.GetString("UserAccountService", String.Empty);
  91. m_BypassClientVerification = serverConfig.GetBoolean("BypassClientVerification", false);
  92. if (gridService == string.Empty || gridUserService == string.Empty || gatekeeperService == string.Empty)
  93. throw new Exception(String.Format("Incomplete specifications, UserAgent Service cannot function."));
  94. Object[] args = new Object[] { config };
  95. m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
  96. m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args);
  97. m_GatekeeperConnector = new GatekeeperServiceConnector();
  98. m_GatekeeperService = ServerUtils.LoadPlugin<IGatekeeperService>(gatekeeperService, args);
  99. m_FriendsService = ServerUtils.LoadPlugin<IFriendsService>(friendsService, args);
  100. m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args);
  101. m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(userAccountService, args);
  102. m_GridName = serverConfig.GetString("ExternalName", string.Empty);
  103. if (m_GridName == string.Empty)
  104. {
  105. serverConfig = config.Configs["GatekeeperService"];
  106. m_GridName = serverConfig.GetString("ExternalName", string.Empty);
  107. }
  108. if (!m_GridName.EndsWith("/"))
  109. m_GridName = m_GridName + "/";
  110. }
  111. }
  112. public GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt)
  113. {
  114. position = new Vector3(128, 128, 0); lookAt = Vector3.UnitY;
  115. m_log.DebugFormat("[USER AGENT SERVICE]: Request to get home region of user {0}", userID);
  116. GridRegion home = null;
  117. GridUserInfo uinfo = m_GridUserService.GetGridUserInfo(userID.ToString());
  118. if (uinfo != null)
  119. {
  120. if (uinfo.HomeRegionID != UUID.Zero)
  121. {
  122. home = m_GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID);
  123. position = uinfo.HomePosition;
  124. lookAt = uinfo.HomeLookAt;
  125. }
  126. if (home == null)
  127. {
  128. List<GridRegion> defs = m_GridService.GetDefaultRegions(UUID.Zero);
  129. if (defs != null && defs.Count > 0)
  130. home = defs[0];
  131. }
  132. }
  133. return home;
  134. }
  135. public bool LoginAgentToGrid(AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint clientIP, out string reason)
  136. {
  137. m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}",
  138. agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), gatekeeper.ServerURI);
  139. // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination
  140. GridRegion region = new GridRegion(gatekeeper);
  141. region.ServerURI = gatekeeper.ServerURI;
  142. region.ExternalHostName = finalDestination.ExternalHostName;
  143. region.InternalEndPoint = finalDestination.InternalEndPoint;
  144. region.RegionName = finalDestination.RegionName;
  145. region.RegionID = finalDestination.RegionID;
  146. region.RegionLocX = finalDestination.RegionLocX;
  147. region.RegionLocY = finalDestination.RegionLocY;
  148. // Generate a new service session
  149. agentCircuit.ServiceSessionID = region.ServerURI + ";" + UUID.Random();
  150. TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region);
  151. bool success = false;
  152. string myExternalIP = string.Empty;
  153. string gridName = gatekeeper.ServerURI;
  154. m_log.DebugFormat("[USER AGENT SERVICE]: this grid: {0}, desired grid: {1}", m_GridName, gridName);
  155. if (m_GridName == gridName)
  156. success = m_GatekeeperService.LoginAgent(agentCircuit, finalDestination, out reason);
  157. else
  158. {
  159. success = m_GatekeeperConnector.CreateAgent(region, agentCircuit, (uint)Constants.TeleportFlags.ViaLogin, out myExternalIP, out reason);
  160. if (success)
  161. // Report them as nowhere
  162. m_PresenceService.ReportAgent(agentCircuit.SessionID, UUID.Zero);
  163. }
  164. if (!success)
  165. {
  166. m_log.DebugFormat("[USER AGENT SERVICE]: Unable to login user {0} {1} to grid {2}, reason: {3}",
  167. agentCircuit.firstname, agentCircuit.lastname, region.ServerURI, reason);
  168. // restore the old travel info
  169. lock (m_TravelingAgents)
  170. {
  171. if (old == null)
  172. m_TravelingAgents.Remove(agentCircuit.SessionID);
  173. else
  174. m_TravelingAgents[agentCircuit.SessionID] = old;
  175. }
  176. return false;
  177. }
  178. m_log.DebugFormat("[USER AGENT SERVICE]: Gatekeeper sees me as {0}", myExternalIP);
  179. // else set the IP addresses associated with this client
  180. if (clientIP != null)
  181. m_TravelingAgents[agentCircuit.SessionID].ClientIPAddress = clientIP.Address.ToString();
  182. m_TravelingAgents[agentCircuit.SessionID].MyIpAddress = myExternalIP;
  183. return true;
  184. }
  185. public bool LoginAgentToGrid(AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, out string reason)
  186. {
  187. reason = string.Empty;
  188. return LoginAgentToGrid(agentCircuit, gatekeeper, finalDestination, null, out reason);
  189. }
  190. private void SetClientIP(UUID sessionID, string ip)
  191. {
  192. if (m_TravelingAgents.ContainsKey(sessionID))
  193. {
  194. m_log.DebugFormat("[USER AGENT SERVICE]: Setting IP {0} for session {1}", ip, sessionID);
  195. m_TravelingAgents[sessionID].ClientIPAddress = ip;
  196. }
  197. }
  198. TravelingAgentInfo UpdateTravelInfo(AgentCircuitData agentCircuit, GridRegion region)
  199. {
  200. TravelingAgentInfo travel = new TravelingAgentInfo();
  201. TravelingAgentInfo old = null;
  202. lock (m_TravelingAgents)
  203. {
  204. if (m_TravelingAgents.ContainsKey(agentCircuit.SessionID))
  205. {
  206. // Very important! Override whatever this agent comes with.
  207. // UserAgentService always sets the IP for every new agent
  208. // with the original IP address.
  209. agentCircuit.IPAddress = m_TravelingAgents[agentCircuit.SessionID].ClientIPAddress;
  210. old = m_TravelingAgents[agentCircuit.SessionID];
  211. }
  212. m_TravelingAgents[agentCircuit.SessionID] = travel;
  213. }
  214. travel.UserID = agentCircuit.AgentID;
  215. travel.GridExternalName = region.ServerURI;
  216. travel.ServiceToken = agentCircuit.ServiceSessionID;
  217. if (old != null)
  218. travel.ClientIPAddress = old.ClientIPAddress;
  219. return old;
  220. }
  221. public void LogoutAgent(UUID userID, UUID sessionID)
  222. {
  223. m_log.DebugFormat("[USER AGENT SERVICE]: User {0} logged out", userID);
  224. lock (m_TravelingAgents)
  225. {
  226. List<UUID> travels = new List<UUID>();
  227. foreach (KeyValuePair<UUID, TravelingAgentInfo> kvp in m_TravelingAgents)
  228. if (kvp.Value == null) // do some clean up
  229. travels.Add(kvp.Key);
  230. else if (kvp.Value.UserID == userID)
  231. travels.Add(kvp.Key);
  232. foreach (UUID session in travels)
  233. m_TravelingAgents.Remove(session);
  234. }
  235. GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(userID.ToString());
  236. if (guinfo != null)
  237. m_GridUserService.LoggedOut(userID.ToString(), sessionID, guinfo.LastRegionID, guinfo.LastPosition, guinfo.LastLookAt);
  238. }
  239. // We need to prevent foreign users with the same UUID as a local user
  240. public bool AgentIsComingHome(UUID sessionID, string thisGridExternalName)
  241. {
  242. if (!m_TravelingAgents.ContainsKey(sessionID))
  243. return false;
  244. TravelingAgentInfo travel = m_TravelingAgents[sessionID];
  245. return travel.GridExternalName.ToLower() == thisGridExternalName.ToLower();
  246. }
  247. public bool VerifyClient(UUID sessionID, string reportedIP)
  248. {
  249. if (m_BypassClientVerification)
  250. return true;
  251. m_log.DebugFormat("[USER AGENT SERVICE]: Verifying Client session {0} with reported IP {1}.",
  252. sessionID, reportedIP);
  253. if (m_TravelingAgents.ContainsKey(sessionID))
  254. {
  255. bool result = m_TravelingAgents[sessionID].ClientIPAddress == reportedIP ||
  256. m_TravelingAgents[sessionID].MyIpAddress == reportedIP; // NATed
  257. m_log.DebugFormat("[USER AGENT SERVICE]: Comparing {0} with login IP {1} and MyIP {1}; result is {3}",
  258. reportedIP, m_TravelingAgents[sessionID].ClientIPAddress, m_TravelingAgents[sessionID].MyIpAddress, result);
  259. return result;
  260. }
  261. return false;
  262. }
  263. public bool VerifyAgent(UUID sessionID, string token)
  264. {
  265. if (m_TravelingAgents.ContainsKey(sessionID))
  266. {
  267. m_log.DebugFormat("[USER AGENT SERVICE]: Verifying agent token {0} against {1}", token, m_TravelingAgents[sessionID].ServiceToken);
  268. return m_TravelingAgents[sessionID].ServiceToken == token;
  269. }
  270. m_log.DebugFormat("[USER AGENT SERVICE]: Token verification for session {0}: no such session", sessionID);
  271. return false;
  272. }
  273. public List<UUID> StatusNotification(List<string> friends, UUID foreignUserID, bool online)
  274. {
  275. if (m_FriendsService == null || m_PresenceService == null)
  276. {
  277. m_log.WarnFormat("[USER AGENT SERVICE]: Unable to perform status notifications because friends or presence services are missing");
  278. return new List<UUID>();
  279. }
  280. List<UUID> localFriendsOnline = new List<UUID>();
  281. m_log.DebugFormat("[USER AGENT SERVICE]: Status notification: foreign user {0} wants to notify {1} local friends", foreignUserID, friends.Count);
  282. // First, let's double check that the reported friends are, indeed, friends of that user
  283. // And let's check that the secret matches
  284. List<string> usersToBeNotified = new List<string>();
  285. foreach (string uui in friends)
  286. {
  287. UUID localUserID;
  288. string secret = string.Empty, tmp = string.Empty;
  289. if (Util.ParseUniversalUserIdentifier(uui, out localUserID, out tmp, out tmp, out tmp, out secret))
  290. {
  291. FriendInfo[] friendInfos = m_FriendsService.GetFriends(localUserID);
  292. foreach (FriendInfo finfo in friendInfos)
  293. {
  294. if (finfo.Friend.StartsWith(foreignUserID.ToString()) && finfo.Friend.EndsWith(secret))
  295. {
  296. // great!
  297. usersToBeNotified.Add(localUserID.ToString());
  298. }
  299. }
  300. }
  301. }
  302. // Now, let's send the notifications
  303. m_log.DebugFormat("[USER AGENT SERVICE]: Status notification: user has {0} local friends", usersToBeNotified.Count);
  304. // First, let's send notifications to local users who are online in the home grid
  305. PresenceInfo[] friendSessions = m_PresenceService.GetAgents(usersToBeNotified.ToArray());
  306. if (friendSessions != null && friendSessions.Length > 0)
  307. {
  308. PresenceInfo friendSession = null;
  309. foreach (PresenceInfo pinfo in friendSessions)
  310. if (pinfo.RegionID != UUID.Zero) // let's guard against traveling agents
  311. {
  312. friendSession = pinfo;
  313. break;
  314. }
  315. if (friendSession != null)
  316. {
  317. ForwardStatusNotificationToSim(friendSession.RegionID, foreignUserID, friendSession.UserID, online);
  318. usersToBeNotified.Remove(friendSession.UserID.ToString());
  319. UUID id;
  320. if (UUID.TryParse(friendSession.UserID, out id))
  321. localFriendsOnline.Add(id);
  322. }
  323. }
  324. // Lastly, let's notify the rest who may be online somewhere else
  325. foreach (string user in usersToBeNotified)
  326. {
  327. UUID id = new UUID(user);
  328. if (m_TravelingAgents.ContainsKey(id) && m_TravelingAgents[id].GridExternalName != m_GridName)
  329. {
  330. string url = m_TravelingAgents[id].GridExternalName;
  331. // forward
  332. m_log.WarnFormat("[USER AGENT SERVICE]: User {0} is visiting {1}. HG Status notifications still not implemented.", user, url);
  333. }
  334. }
  335. // and finally, let's send the online friends
  336. if (online)
  337. {
  338. return localFriendsOnline;
  339. }
  340. else
  341. return new List<UUID>();
  342. }
  343. protected void ForwardStatusNotificationToSim(UUID regionID, UUID foreignUserID, string user, bool online)
  344. {
  345. UUID userID;
  346. if (UUID.TryParse(user, out userID))
  347. {
  348. if (m_FriendsLocalSimConnector != null)
  349. {
  350. m_log.DebugFormat("[USER AGENT SERVICE]: Local Notify, user {0} is {1}", foreignUserID, (online ? "online" : "offline"));
  351. m_FriendsLocalSimConnector.StatusNotify(foreignUserID, userID, online);
  352. }
  353. else
  354. {
  355. GridRegion region = m_GridService.GetRegionByUUID(UUID.Zero /* !!! */, regionID);
  356. if (region != null)
  357. {
  358. m_log.DebugFormat("[USER AGENT SERVICE]: Remote Notify to region {0}, user {1} is {2}", region.RegionName, foreignUserID, (online ? "online" : "offline"));
  359. m_FriendsSimConnector.StatusNotify(region, foreignUserID, userID, online);
  360. }
  361. }
  362. }
  363. }
  364. public List<UUID> GetOnlineFriends(UUID foreignUserID, List<string> friends)
  365. {
  366. List<UUID> online = new List<UUID>();
  367. if (m_FriendsService == null || m_PresenceService == null)
  368. {
  369. m_log.WarnFormat("[USER AGENT SERVICE]: Unable to get online friends because friends or presence services are missing");
  370. return online;
  371. }
  372. m_log.DebugFormat("[USER AGENT SERVICE]: Foreign user {0} wants to know status of {1} local friends", foreignUserID, friends.Count);
  373. // First, let's double check that the reported friends are, indeed, friends of that user
  374. // And let's check that the secret matches and the rights
  375. List<string> usersToBeNotified = new List<string>();
  376. foreach (string uui in friends)
  377. {
  378. UUID localUserID;
  379. string secret = string.Empty, tmp = string.Empty;
  380. if (Util.ParseUniversalUserIdentifier(uui, out localUserID, out tmp, out tmp, out tmp, out secret))
  381. {
  382. FriendInfo[] friendInfos = m_FriendsService.GetFriends(localUserID);
  383. foreach (FriendInfo finfo in friendInfos)
  384. {
  385. if (finfo.Friend.StartsWith(foreignUserID.ToString()) && finfo.Friend.EndsWith(secret) &&
  386. (finfo.TheirFlags & (int)FriendRights.CanSeeOnline) != 0 && (finfo.TheirFlags != -1))
  387. {
  388. // great!
  389. usersToBeNotified.Add(localUserID.ToString());
  390. }
  391. }
  392. }
  393. }
  394. // Now, let's find out their status
  395. m_log.DebugFormat("[USER AGENT SERVICE]: GetOnlineFriends: user has {0} local friends with status rights", usersToBeNotified.Count);
  396. // First, let's send notifications to local users who are online in the home grid
  397. PresenceInfo[] friendSessions = m_PresenceService.GetAgents(usersToBeNotified.ToArray());
  398. if (friendSessions != null && friendSessions.Length > 0)
  399. {
  400. foreach (PresenceInfo pi in friendSessions)
  401. {
  402. UUID presenceID;
  403. if (UUID.TryParse(pi.UserID, out presenceID))
  404. online.Add(presenceID);
  405. }
  406. }
  407. return online;
  408. }
  409. public Dictionary<string, object> GetServerURLs(UUID userID)
  410. {
  411. if (m_UserAccountService == null)
  412. {
  413. m_log.WarnFormat("[USER AGENT SERVICE]: Unable to get server URLs because user account service is missing");
  414. return new Dictionary<string, object>();
  415. }
  416. UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero /*!!!*/, userID);
  417. if (account != null)
  418. return account.ServiceURLs;
  419. return new Dictionary<string, object>();
  420. }
  421. public string LocateUser(UUID userID)
  422. {
  423. foreach (TravelingAgentInfo t in m_TravelingAgents.Values)
  424. {
  425. if (t == null)
  426. {
  427. m_log.ErrorFormat("[USER AGENT SERVICE]: Oops! Null TravelingAgentInfo. Please report this on mantis");
  428. continue;
  429. }
  430. if (t.UserID == userID && !m_GridName.Equals(t.GridExternalName))
  431. return t.GridExternalName;
  432. }
  433. return string.Empty;
  434. }
  435. public string GetUUI(UUID userID, UUID targetUserID)
  436. {
  437. // Let's see if it's a local user
  438. UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero, targetUserID);
  439. if (account != null)
  440. return targetUserID.ToString() + ";" + m_GridName + ";" + account.FirstName + " " + account.LastName ;
  441. // Let's try the list of friends
  442. FriendInfo[] friends = m_FriendsService.GetFriends(userID);
  443. if (friends != null && friends.Length > 0)
  444. {
  445. foreach (FriendInfo f in friends)
  446. if (f.Friend.StartsWith(targetUserID.ToString()))
  447. {
  448. // Let's remove the secret
  449. UUID id; string tmp = string.Empty, secret = string.Empty;
  450. if (Util.ParseUniversalUserIdentifier(f.Friend, out id, out tmp, out tmp, out tmp, out secret))
  451. return f.Friend.Replace(secret, "0");
  452. }
  453. }
  454. return string.Empty;
  455. }
  456. }
  457. class TravelingAgentInfo
  458. {
  459. public UUID UserID;
  460. public string GridExternalName = string.Empty;
  461. public string ServiceToken = string.Empty;
  462. public string ClientIPAddress = string.Empty; // as seen from this user agent service
  463. public string MyIpAddress = string.Empty; // the user agent service's external IP, as seen from the next gatekeeper
  464. }
  465. }