public string GetUserServerURL(UUID userID, string serverType) { UserData userdata; lock (m_UserCache) m_UserCache.TryGetValue(userID, out userdata); if (userdata != null) { // m_log.DebugFormat("[USER MANAGEMENT MODULE]: Requested url type {0} for {1}", serverType, userID); if (userdata.ServerURLs != null && userdata.ServerURLs.ContainsKey(serverType) && userdata.ServerURLs[serverType] != null) { return userdata.ServerURLs[serverType].ToString(); } if (!string.IsNullOrEmpty(userdata.HomeURL)) { //m_log.DebugFormat( // "[USER MANAGEMENT MODULE]: Did not find url type {0} so requesting urls from '{1}' for {2}", // serverType, userdata.HomeURL, userID); UserAgentServiceConnector uConn = new UserAgentServiceConnector(userdata.HomeURL); try { userdata.ServerURLs = uConn.GetServerURLs(userID); } catch (Exception e) { m_log.Debug("[USER MANAGEMENT MODULE]: GetServerURLs call failed ", e); userdata.ServerURLs = new Dictionary<string, object>(); } if (userdata.ServerURLs != null && userdata.ServerURLs.ContainsKey(serverType) && userdata.ServerURLs[serverType] != null) return userdata.ServerURLs[serverType].ToString(); } } return string.Empty; }
private void ProcessFriendshipOffered(UUID fromID, String fromName, UUID toID, String message) { // Great, it's a genuine request. Let's proceed. // But now we need to confirm that the requester is who he says he is // before we act on the friendship request. if (!fromName.Contains("@")) return; string[] parts = fromName.Split(new char[] {'@'}); if (parts.Length != 2) return; string uriStr = "http://" + parts[1]; try { new Uri(uriStr); } catch (UriFormatException) { return; } UserAgentServiceConnector uasConn = new UserAgentServiceConnector(uriStr); Dictionary<string, object> servers = uasConn.GetServerURLs(fromID); if (!servers.ContainsKey("FriendsServerURI")) return; HGFriendsServicesConnector friendsConn = new HGFriendsServicesConnector(servers["FriendsServerURI"].ToString()); if (!friendsConn.ValidateFriendshipOffered(fromID, toID)) { m_log.WarnFormat("[HGFRIENDS SERVICE]: Friendship request from {0} to {1} is invalid. Impersonations?", fromID, toID); return; } string fromUUI = Util.UniversalIdentifier(fromID, parts[0], "@" + parts[1], uriStr); // OK, we're good! ForwardToSim("FriendshipOffered", fromID, fromName, fromUUI, toID, message); }
public string GetUserServerURL(UUID userID, string serverType) { UserData userdata; lock (m_UserCache) m_UserCache.TryGetValue(userID, out userdata); if (userdata != null) { // m_log.DebugFormat("[UserManagementModule]: Requested url type {0} for {1}", serverType, userID); if (userdata.ServerURLs != null && userdata.ServerURLs.ContainsKey(serverType) && userdata.ServerURLs[serverType] != null) { return userdata.ServerURLs[serverType].ToString(); } if (userdata.HomeURL != null && userdata.HomeURL != string.Empty) { //m_log.DebugFormat( // "[UserManagementModule]: Did not find url type {0} so requesting urls from '{1}' for {2}", // serverType, userdata.HomeURL, userID); UserAgentServiceConnector uConn = new UserAgentServiceConnector(userdata.HomeURL); userdata.ServerURLs = uConn.GetServerURLs(userID); if (userdata.ServerURLs != null && userdata.ServerURLs.ContainsKey(serverType) && userdata.ServerURLs[serverType] != null) return userdata.ServerURLs[serverType].ToString(); } } return string.Empty; }
public string GetUserServerURL(UUID userID, string serverType) { UserData userdata; if(!GetUser(userID, out userdata)) { return string.Empty; } if (userdata.ServerURLs != null && userdata.ServerURLs.ContainsKey(serverType) && userdata.ServerURLs[serverType] != null) { return userdata.ServerURLs[serverType].ToString(); } if (!string.IsNullOrEmpty(userdata.HomeURL)) { // m_log.DebugFormat("[USER MANAGEMENT MODULE]: Requested url type {0} for {1}", serverType, userID); UserAgentServiceConnector uConn = new UserAgentServiceConnector(userdata.HomeURL); try { userdata.ServerURLs = uConn.GetServerURLs(userID); } catch(System.Net.WebException e) { m_log.DebugFormat("[USER MANAGEMENT MODULE]: GetServerURLs call failed {0}", e.Message); userdata.ServerURLs = new Dictionary<string, object>(); } catch (Exception e) { m_log.Debug("[USER MANAGEMENT MODULE]: GetServerURLs call failed ", e); userdata.ServerURLs = new Dictionary<string, object>(); } if (userdata.ServerURLs != null && userdata.ServerURLs.ContainsKey(serverType) && userdata.ServerURLs[serverType] != null) return userdata.ServerURLs[serverType].ToString(); } return string.Empty; }
public string GetUserServerURL(UUID userID, string serverType) { if (m_UserCache.ContainsKey(userID)) { UserData userdata = m_UserCache[userID]; if (userdata.ServerURLs != null && userdata.ServerURLs.ContainsKey(serverType) && userdata.ServerURLs[serverType] != null) return userdata.ServerURLs[serverType].ToString(); if (userdata.HomeURL != string.Empty) { UserAgentServiceConnector uConn = new UserAgentServiceConnector(userdata.HomeURL); userdata.ServerURLs = uConn.GetServerURLs(userID); if (userdata.ServerURLs != null && userdata.ServerURLs.ContainsKey(serverType) && userdata.ServerURLs[serverType] != null) return userdata.ServerURLs[serverType].ToString(); } } return string.Empty; }