diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Server/Handlers/GridUser/GridUserServerConnector.cs | 5 | ||||
-rw-r--r-- | OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs | 29 |
2 files changed, 14 insertions, 20 deletions
diff --git a/OpenSim/Server/Handlers/GridUser/GridUserServerConnector.cs b/OpenSim/Server/Handlers/GridUser/GridUserServerConnector.cs index 66f35e3..1e29378 100644 --- a/OpenSim/Server/Handlers/GridUser/GridUserServerConnector.cs +++ b/OpenSim/Server/Handlers/GridUser/GridUserServerConnector.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using Nini.Config; | 29 | using Nini.Config; |
30 | using OpenSim.Server.Base; | 30 | using OpenSim.Server.Base; |
31 | using OpenSim.Services.Interfaces; | 31 | using OpenSim.Services.Interfaces; |
32 | using OpenSim.Framework.ServiceAuth; | ||
32 | using OpenSim.Framework.Servers.HttpServer; | 33 | using OpenSim.Framework.Servers.HttpServer; |
33 | using OpenSim.Server.Handlers.Base; | 34 | using OpenSim.Server.Handlers.Base; |
34 | 35 | ||
@@ -55,7 +56,9 @@ namespace OpenSim.Server.Handlers.GridUser | |||
55 | Object[] args = new Object[] { config }; | 56 | Object[] args = new Object[] { config }; |
56 | m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(service, args); | 57 | m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(service, args); |
57 | 58 | ||
58 | server.AddStreamHandler(new GridUserServerPostHandler(m_GridUserService)); | 59 | IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); ; |
60 | |||
61 | server.AddStreamHandler(new GridUserServerPostHandler(m_GridUserService, auth)); | ||
59 | } | 62 | } |
60 | } | 63 | } |
61 | } | 64 | } |
diff --git a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs index 687cf8d..9237c63 100644 --- a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs +++ b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs | |||
@@ -39,6 +39,7 @@ using System.Collections.Generic; | |||
39 | using OpenSim.Server.Base; | 39 | using OpenSim.Server.Base; |
40 | using OpenSim.Services.Interfaces; | 40 | using OpenSim.Services.Interfaces; |
41 | using OpenSim.Framework; | 41 | using OpenSim.Framework; |
42 | using OpenSim.Framework.ServiceAuth; | ||
42 | using OpenSim.Framework.Servers.HttpServer; | 43 | using OpenSim.Framework.Servers.HttpServer; |
43 | using OpenMetaverse; | 44 | using OpenMetaverse; |
44 | 45 | ||
@@ -50,13 +51,13 @@ namespace OpenSim.Server.Handlers.GridUser | |||
50 | 51 | ||
51 | private IGridUserService m_GridUserService; | 52 | private IGridUserService m_GridUserService; |
52 | 53 | ||
53 | public GridUserServerPostHandler(IGridUserService service) : | 54 | public GridUserServerPostHandler(IGridUserService service, IServiceAuth auth) : |
54 | base("POST", "/griduser") | 55 | base("POST", "/griduser", auth) |
55 | { | 56 | { |
56 | m_GridUserService = service; | 57 | m_GridUserService = service; |
57 | } | 58 | } |
58 | 59 | ||
59 | public override byte[] Handle(string path, Stream requestData, | 60 | protected override byte[] ProcessRequest(string path, Stream requestData, |
60 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 61 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
61 | { | 62 | { |
62 | StreamReader sr = new StreamReader(requestData); | 63 | StreamReader sr = new StreamReader(requestData); |
@@ -185,10 +186,12 @@ namespace OpenSim.Server.Handlers.GridUser | |||
185 | GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(user); | 186 | GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(user); |
186 | 187 | ||
187 | Dictionary<string, object> result = new Dictionary<string, object>(); | 188 | Dictionary<string, object> result = new Dictionary<string, object>(); |
188 | result["result"] = guinfo.ToKeyValuePairs(); | 189 | if (guinfo != null) |
190 | result["result"] = guinfo.ToKeyValuePairs(); | ||
191 | else | ||
192 | result["result"] = "null"; | ||
189 | 193 | ||
190 | string xmlString = ServerUtils.BuildXmlResponse(result); | 194 | string xmlString = ServerUtils.BuildXmlResponse(result); |
191 | |||
192 | //m_log.DebugFormat("[GRID USER HANDLER]: resp string: {0}", xmlString); | 195 | //m_log.DebugFormat("[GRID USER HANDLER]: resp string: {0}", xmlString); |
193 | return Util.UTF8NoBomEncoding.GetBytes(xmlString); | 196 | return Util.UTF8NoBomEncoding.GetBytes(xmlString); |
194 | } | 197 | } |
@@ -276,7 +279,7 @@ namespace OpenSim.Server.Handlers.GridUser | |||
276 | 279 | ||
277 | rootElement.AppendChild(result); | 280 | rootElement.AppendChild(result); |
278 | 281 | ||
279 | return DocToBytes(doc); | 282 | return Util.DocToBytes(doc); |
280 | } | 283 | } |
281 | 284 | ||
282 | private byte[] FailureResult() | 285 | private byte[] FailureResult() |
@@ -298,20 +301,8 @@ namespace OpenSim.Server.Handlers.GridUser | |||
298 | 301 | ||
299 | rootElement.AppendChild(result); | 302 | rootElement.AppendChild(result); |
300 | 303 | ||
301 | return DocToBytes(doc); | 304 | return Util.DocToBytes(doc); |
302 | } | 305 | } |
303 | 306 | ||
304 | private byte[] DocToBytes(XmlDocument doc) | ||
305 | { | ||
306 | MemoryStream ms = new MemoryStream(); | ||
307 | XmlTextWriter xw = new XmlTextWriter(ms, null); | ||
308 | xw.Formatting = Formatting.Indented; | ||
309 | doc.WriteTo(xw); | ||
310 | xw.Flush(); | ||
311 | |||
312 | return ms.ToArray(); | ||
313 | } | ||
314 | |||
315 | |||
316 | } | 307 | } |
317 | } | 308 | } |