diff options
Diffstat (limited to 'OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs')
-rw-r--r-- | OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs index 6b93cd9..6ee98b3 100644 --- a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.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 | ||
@@ -55,10 +56,10 @@ namespace OpenSim.Server.Handlers.Authentication | |||
55 | private bool m_AllowSetPassword = false; | 56 | private bool m_AllowSetPassword = false; |
56 | 57 | ||
57 | public AuthenticationServerPostHandler(IAuthenticationService service) : | 58 | public AuthenticationServerPostHandler(IAuthenticationService service) : |
58 | this(service, null) {} | 59 | this(service, null, null) {} |
59 | 60 | ||
60 | public AuthenticationServerPostHandler(IAuthenticationService service, IConfig config) : | 61 | public AuthenticationServerPostHandler(IAuthenticationService service, IConfig config, IServiceAuth auth) : |
61 | base("POST", "/auth") | 62 | base("POST", "/auth", auth) |
62 | { | 63 | { |
63 | m_AuthenticationService = service; | 64 | m_AuthenticationService = service; |
64 | 65 | ||
@@ -70,9 +71,10 @@ namespace OpenSim.Server.Handlers.Authentication | |||
70 | } | 71 | } |
71 | } | 72 | } |
72 | 73 | ||
73 | public override byte[] Handle(string path, Stream request, | 74 | protected override byte[] ProcessRequest(string path, Stream request, |
74 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 75 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
75 | { | 76 | { |
77 | // m_log.Error("[XXX]: Authenticating..."); | ||
76 | string[] p = SplitParams(path); | 78 | string[] p = SplitParams(path); |
77 | 79 | ||
78 | if (p.Length > 0) | 80 | if (p.Length > 0) |
@@ -207,7 +209,7 @@ namespace OpenSim.Server.Handlers.Authentication | |||
207 | 209 | ||
208 | rootElement.AppendChild(result); | 210 | rootElement.AppendChild(result); |
209 | 211 | ||
210 | return DocToBytes(doc); | 212 | return Util.DocToBytes(doc); |
211 | } | 213 | } |
212 | 214 | ||
213 | byte[] GetAuthInfo(UUID principalID) | 215 | byte[] GetAuthInfo(UUID principalID) |
@@ -277,7 +279,7 @@ namespace OpenSim.Server.Handlers.Authentication | |||
277 | 279 | ||
278 | rootElement.AppendChild(result); | 280 | rootElement.AppendChild(result); |
279 | 281 | ||
280 | return DocToBytes(doc); | 282 | return Util.DocToBytes(doc); |
281 | } | 283 | } |
282 | 284 | ||
283 | private byte[] SuccessResult(string token) | 285 | private byte[] SuccessResult(string token) |
@@ -304,18 +306,7 @@ namespace OpenSim.Server.Handlers.Authentication | |||
304 | 306 | ||
305 | rootElement.AppendChild(t); | 307 | rootElement.AppendChild(t); |
306 | 308 | ||
307 | return DocToBytes(doc); | 309 | return Util.DocToBytes(doc); |
308 | } | ||
309 | |||
310 | private byte[] DocToBytes(XmlDocument doc) | ||
311 | { | ||
312 | MemoryStream ms = new MemoryStream(); | ||
313 | XmlTextWriter xw = new XmlTextWriter(ms, null); | ||
314 | xw.Formatting = Formatting.Indented; | ||
315 | doc.WriteTo(xw); | ||
316 | xw.Flush(); | ||
317 | |||
318 | return ms.GetBuffer(); | ||
319 | } | 310 | } |
320 | 311 | ||
321 | private byte[] ResultToBytes(Dictionary<string, object> result) | 312 | private byte[] ResultToBytes(Dictionary<string, object> result) |