diff options
Merge branch 'master' into diva-textures
Diffstat (limited to 'OpenSim/Grid/UserServer.Modules')
-rw-r--r-- | OpenSim/Grid/UserServer.Modules/UserLoginAuthService.cs | 2 | ||||
-rw-r--r-- | OpenSim/Grid/UserServer.Modules/UserLoginService.cs | 70 | ||||
-rw-r--r-- | OpenSim/Grid/UserServer.Modules/UserManager.cs | 56 |
3 files changed, 90 insertions, 38 deletions
diff --git a/OpenSim/Grid/UserServer.Modules/UserLoginAuthService.cs b/OpenSim/Grid/UserServer.Modules/UserLoginAuthService.cs index 9d31d81..77caf47 100644 --- a/OpenSim/Grid/UserServer.Modules/UserLoginAuthService.cs +++ b/OpenSim/Grid/UserServer.Modules/UserLoginAuthService.cs | |||
@@ -47,7 +47,7 @@ namespace OpenSim.Grid.UserServer.Modules | |||
47 | 47 | ||
48 | /// <summary> | 48 | /// <summary> |
49 | /// Hypergrid login service used in grid mode. | 49 | /// Hypergrid login service used in grid mode. |
50 | /// </summary> | 50 | /// </summary> |
51 | public class UserLoginAuthService : HGLoginAuthService | 51 | public class UserLoginAuthService : HGLoginAuthService |
52 | { | 52 | { |
53 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 53 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
diff --git a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs b/OpenSim/Grid/UserServer.Modules/UserLoginService.cs index 01d5537..7d0e0de 100644 --- a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs +++ b/OpenSim/Grid/UserServer.Modules/UserLoginService.cs | |||
@@ -34,6 +34,7 @@ using System.Text.RegularExpressions; | |||
34 | using log4net; | 34 | using log4net; |
35 | using Nwc.XmlRpc; | 35 | using Nwc.XmlRpc; |
36 | using OpenMetaverse; | 36 | using OpenMetaverse; |
37 | using Nini.Config; | ||
37 | using OpenSim.Data; | 38 | using OpenSim.Data; |
38 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
39 | using OpenSim.Framework.Communications; | 40 | using OpenSim.Framework.Communications; |
@@ -42,6 +43,9 @@ using OpenSim.Framework.Communications.Cache; | |||
42 | using OpenSim.Framework.Capabilities; | 43 | using OpenSim.Framework.Capabilities; |
43 | using OpenSim.Framework.Servers; | 44 | using OpenSim.Framework.Servers; |
44 | using OpenSim.Framework.Servers.HttpServer; | 45 | using OpenSim.Framework.Servers.HttpServer; |
46 | using OpenSim.Services.Interfaces; | ||
47 | using OpenSim.Services.Connectors; | ||
48 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
45 | 49 | ||
46 | namespace OpenSim.Grid.UserServer.Modules | 50 | namespace OpenSim.Grid.UserServer.Modules |
47 | { | 51 | { |
@@ -51,7 +55,7 @@ namespace OpenSim.Grid.UserServer.Modules | |||
51 | 55 | ||
52 | /// <summary> | 56 | /// <summary> |
53 | /// Login service used in grid mode. | 57 | /// Login service used in grid mode. |
54 | /// </summary> | 58 | /// </summary> |
55 | public class UserLoginService : LoginService | 59 | public class UserLoginService : LoginService |
56 | { | 60 | { |
57 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 61 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -63,6 +67,8 @@ namespace OpenSim.Grid.UserServer.Modules | |||
63 | public UserConfig m_config; | 67 | public UserConfig m_config; |
64 | private readonly IRegionProfileRouter m_regionProfileService; | 68 | private readonly IRegionProfileRouter m_regionProfileService; |
65 | 69 | ||
70 | private IGridService m_GridService; | ||
71 | |||
66 | protected BaseHttpServer m_httpServer; | 72 | protected BaseHttpServer m_httpServer; |
67 | 73 | ||
68 | public UserLoginService( | 74 | public UserLoginService( |
@@ -76,6 +82,8 @@ namespace OpenSim.Grid.UserServer.Modules | |||
76 | m_defaultHomeY = m_config.DefaultY; | 82 | m_defaultHomeY = m_config.DefaultY; |
77 | m_interInventoryService = inventoryService; | 83 | m_interInventoryService = inventoryService; |
78 | m_regionProfileService = regionProfileService; | 84 | m_regionProfileService = regionProfileService; |
85 | |||
86 | m_GridService = new GridServicesConnector(config.GridServerURL.ToString()); | ||
79 | } | 87 | } |
80 | 88 | ||
81 | public void RegisterHandlers(BaseHttpServer httpServer, bool registerLLSDHandler, bool registerOpenIDHandlers) | 89 | public void RegisterHandlers(BaseHttpServer httpServer, bool registerLLSDHandler, bool registerOpenIDHandlers) |
@@ -203,47 +211,38 @@ namespace OpenSim.Grid.UserServer.Modules | |||
203 | 211 | ||
204 | protected override RegionInfo RequestClosestRegion(string region) | 212 | protected override RegionInfo RequestClosestRegion(string region) |
205 | { | 213 | { |
206 | RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(region, | 214 | return GridRegionToRegionInfo(m_GridService.GetRegionByName(UUID.Zero, region)); |
207 | m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); | ||
208 | |||
209 | if (profileData != null) | ||
210 | { | ||
211 | return profileData.ToRegionInfo(); | ||
212 | } | ||
213 | else | ||
214 | { | ||
215 | return null; | ||
216 | } | ||
217 | } | 215 | } |
218 | 216 | ||
219 | protected override RegionInfo GetRegionInfo(ulong homeRegionHandle) | 217 | protected override RegionInfo GetRegionInfo(ulong homeRegionHandle) |
220 | { | 218 | { |
221 | RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(homeRegionHandle, | 219 | uint x = 0, y = 0; |
222 | m_config.GridServerURL, m_config.GridSendKey, | 220 | Utils.LongToUInts(homeRegionHandle, out x, out y); |
223 | m_config.GridRecvKey); | 221 | return GridRegionToRegionInfo(m_GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y)); |
224 | if (profileData != null) | ||
225 | { | ||
226 | return profileData.ToRegionInfo(); | ||
227 | } | ||
228 | else | ||
229 | { | ||
230 | return null; | ||
231 | } | ||
232 | } | 222 | } |
233 | 223 | ||
234 | protected override RegionInfo GetRegionInfo(UUID homeRegionId) | 224 | protected override RegionInfo GetRegionInfo(UUID homeRegionId) |
235 | { | 225 | { |
236 | RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(homeRegionId, | 226 | return GridRegionToRegionInfo(m_GridService.GetRegionByUUID(UUID.Zero, homeRegionId)); |
237 | m_config.GridServerURL, m_config.GridSendKey, | 227 | } |
238 | m_config.GridRecvKey); | 228 | |
239 | if (profileData != null) | 229 | private RegionInfo GridRegionToRegionInfo(GridRegion gregion) |
240 | { | 230 | { |
241 | return profileData.ToRegionInfo(); | 231 | if (gregion == null) |
242 | } | ||
243 | else | ||
244 | { | ||
245 | return null; | 232 | return null; |
246 | } | 233 | |
234 | RegionInfo rinfo = new RegionInfo(); | ||
235 | rinfo.ExternalHostName = gregion.ExternalHostName; | ||
236 | rinfo.HttpPort = gregion.HttpPort; | ||
237 | rinfo.InternalEndPoint = gregion.InternalEndPoint; | ||
238 | rinfo.RegionID = gregion.RegionID; | ||
239 | rinfo.RegionLocX = (uint)(gregion.RegionLocX / Constants.RegionSize); | ||
240 | rinfo.RegionLocY = (uint)(gregion.RegionLocY / Constants.RegionSize); | ||
241 | rinfo.RegionName = gregion.RegionName; | ||
242 | rinfo.ScopeID = gregion.ScopeID; | ||
243 | rinfo.ServerURI = gregion.ServerURI; | ||
244 | |||
245 | return rinfo; | ||
247 | } | 246 | } |
248 | 247 | ||
249 | protected override bool PrepareLoginToRegion(RegionInfo regionInfo, UserProfileData user, LoginResponse response, IPEndPoint remoteClient) | 248 | protected override bool PrepareLoginToRegion(RegionInfo regionInfo, UserProfileData user, LoginResponse response, IPEndPoint remoteClient) |
@@ -280,9 +279,8 @@ namespace OpenSim.Grid.UserServer.Modules | |||
280 | //response.SeedCapability = serverURI + CapsUtil.GetCapsSeedPath(capsPath); | 279 | //response.SeedCapability = serverURI + CapsUtil.GetCapsSeedPath(capsPath); |
281 | 280 | ||
282 | // Take off trailing / so that the caps path isn't //CAPS/someUUID | 281 | // Take off trailing / so that the caps path isn't //CAPS/someUUID |
283 | if (regionInfo.httpServerURI.EndsWith("/")) | 282 | string uri = regionInfo.httpServerURI.Trim(new char[] { '/' }); |
284 | regionInfo.httpServerURI = regionInfo.httpServerURI.Substring(0, regionInfo.httpServerURI.Length - 1); | 283 | response.SeedCapability = uri + CapsUtil.GetCapsSeedPath(capsPath); |
285 | response.SeedCapability = regionInfo.httpServerURI + CapsUtil.GetCapsSeedPath(capsPath); | ||
286 | 284 | ||
287 | 285 | ||
288 | // Notify the target of an incoming user | 286 | // Notify the target of an incoming user |
diff --git a/OpenSim/Grid/UserServer.Modules/UserManager.cs b/OpenSim/Grid/UserServer.Modules/UserManager.cs index 002f232..36c6297 100644 --- a/OpenSim/Grid/UserServer.Modules/UserManager.cs +++ b/OpenSim/Grid/UserServer.Modules/UserManager.cs | |||
@@ -108,6 +108,9 @@ namespace OpenSim.Grid.UserServer.Modules | |||
108 | m_httpServer.AddXmlRPCHandler("get_user_by_uuid", XmlRPCGetUserMethodUUID); | 108 | m_httpServer.AddXmlRPCHandler("get_user_by_uuid", XmlRPCGetUserMethodUUID); |
109 | m_httpServer.AddXmlRPCHandler("get_avatar_picker_avatar", XmlRPCGetAvatarPickerAvatar); | 109 | m_httpServer.AddXmlRPCHandler("get_avatar_picker_avatar", XmlRPCGetAvatarPickerAvatar); |
110 | 110 | ||
111 | // Used by IAR module to do password checks | ||
112 | m_httpServer.AddXmlRPCHandler("authenticate_user_by_password", XmlRPCAuthenticateUserMethodPassword); | ||
113 | |||
111 | m_httpServer.AddXmlRPCHandler("update_user_current_region", XmlRPCAtRegion); | 114 | m_httpServer.AddXmlRPCHandler("update_user_current_region", XmlRPCAtRegion); |
112 | m_httpServer.AddXmlRPCHandler("logout_of_simulator", XmlRPCLogOffUserMethodUUID); | 115 | m_httpServer.AddXmlRPCHandler("logout_of_simulator", XmlRPCLogOffUserMethodUUID); |
113 | m_httpServer.AddXmlRPCHandler("get_agent_by_uuid", XmlRPCGetAgentMethodUUID); | 116 | m_httpServer.AddXmlRPCHandler("get_agent_by_uuid", XmlRPCGetAgentMethodUUID); |
@@ -203,6 +206,57 @@ namespace OpenSim.Grid.UserServer.Modules | |||
203 | 206 | ||
204 | #region XMLRPC User Methods | 207 | #region XMLRPC User Methods |
205 | 208 | ||
209 | /// <summary> | ||
210 | /// Authenticate a user using their password | ||
211 | /// </summary> | ||
212 | /// <param name="request">Must contain values for "user_uuid" and "password" keys</param> | ||
213 | /// <param name="remoteClient"></param> | ||
214 | /// <returns></returns> | ||
215 | public XmlRpcResponse XmlRPCAuthenticateUserMethodPassword(XmlRpcRequest request, IPEndPoint remoteClient) | ||
216 | { | ||
217 | // m_log.DebugFormat("[USER MANAGER]: Received authenticated user by password request from {0}", remoteClient); | ||
218 | |||
219 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
220 | string userUuidRaw = (string)requestData["user_uuid"]; | ||
221 | string password = (string)requestData["password"]; | ||
222 | |||
223 | if (null == userUuidRaw) | ||
224 | return Util.CreateUnknownUserErrorResponse(); | ||
225 | |||
226 | UUID userUuid; | ||
227 | if (!UUID.TryParse(userUuidRaw, out userUuid)) | ||
228 | return Util.CreateUnknownUserErrorResponse(); | ||
229 | |||
230 | UserProfileData userProfile = m_userDataBaseService.GetUserProfile(userUuid); | ||
231 | if (null == userProfile) | ||
232 | return Util.CreateUnknownUserErrorResponse(); | ||
233 | |||
234 | string authed; | ||
235 | |||
236 | if (null == password) | ||
237 | { | ||
238 | authed = "FALSE"; | ||
239 | } | ||
240 | else | ||
241 | { | ||
242 | if (m_userDataBaseService.AuthenticateUserByPassword(userUuid, password)) | ||
243 | authed = "TRUE"; | ||
244 | else | ||
245 | authed = "FALSE"; | ||
246 | } | ||
247 | |||
248 | // m_log.DebugFormat( | ||
249 | // "[USER MANAGER]: Authentication by password result from {0} for {1} is {2}", | ||
250 | // remoteClient, userUuid, authed); | ||
251 | |||
252 | XmlRpcResponse response = new XmlRpcResponse(); | ||
253 | Hashtable responseData = new Hashtable(); | ||
254 | responseData["auth_user"] = authed; | ||
255 | response.Value = responseData; | ||
256 | |||
257 | return response; | ||
258 | } | ||
259 | |||
206 | public XmlRpcResponse XmlRPCGetAvatarPickerAvatar(XmlRpcRequest request, IPEndPoint remoteClient) | 260 | public XmlRpcResponse XmlRPCGetAvatarPickerAvatar(XmlRpcRequest request, IPEndPoint remoteClient) |
207 | { | 261 | { |
208 | // XmlRpcResponse response = new XmlRpcResponse(); | 262 | // XmlRpcResponse response = new XmlRpcResponse(); |
@@ -246,10 +300,10 @@ namespace OpenSim.Grid.UserServer.Modules | |||
246 | m_userDataBaseService.CommitAgent(ref userProfile); | 300 | m_userDataBaseService.CommitAgent(ref userProfile); |
247 | //setUserProfile(userProfile); | 301 | //setUserProfile(userProfile); |
248 | 302 | ||
249 | |||
250 | returnstring = "TRUE"; | 303 | returnstring = "TRUE"; |
251 | } | 304 | } |
252 | } | 305 | } |
306 | |||
253 | responseData.Add("returnString", returnstring); | 307 | responseData.Add("returnString", returnstring); |
254 | response.Value = responseData; | 308 | response.Value = responseData; |
255 | return response; | 309 | return response; |