diff options
author | Melanie | 2009-09-19 18:06:25 +0100 |
---|---|---|
committer | Melanie | 2009-09-19 18:06:25 +0100 |
commit | 2f624800d37bae36cecf1bff191b646d59d86746 (patch) | |
tree | 4ece499924c10bbf8ea8f225fede0e59beab9da1 | |
parent | Add the skeleton of the authentication connector and the forms data requester (diff) | |
download | opensim-SC_OLD-2f624800d37bae36cecf1bff191b646d59d86746.zip opensim-SC_OLD-2f624800d37bae36cecf1bff191b646d59d86746.tar.gz opensim-SC_OLD-2f624800d37bae36cecf1bff191b646d59d86746.tar.bz2 opensim-SC_OLD-2f624800d37bae36cecf1bff191b646d59d86746.tar.xz |
Adding the deserializer for server form/xml replies
Diffstat (limited to '')
3 files changed, 57 insertions, 3 deletions
diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index ae7ec0f..6c2b3ed 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs | |||
@@ -255,5 +255,47 @@ namespace OpenSim.Server.Base | |||
255 | parent.AppendChild(elem); | 255 | parent.AppendChild(elem); |
256 | } | 256 | } |
257 | } | 257 | } |
258 | |||
259 | public static Dictionary<string, object> ParseXmlResponse(string data) | ||
260 | { | ||
261 | Dictionary<string, object> ret = new Dictionary<string, object>(); | ||
262 | |||
263 | XmlDocument doc = new XmlDocument(); | ||
264 | |||
265 | doc.LoadXml(data); | ||
266 | |||
267 | XmlNodeList rootL = doc.GetElementsByTagName("ServerResponse"); | ||
268 | |||
269 | if (rootL.Count != 1) | ||
270 | return ret; | ||
271 | |||
272 | XmlNode rootNode = rootL[0]; | ||
273 | |||
274 | ret = ParseElement(rootNode); | ||
275 | |||
276 | return ret; | ||
277 | } | ||
278 | |||
279 | private static Dictionary<string, object> ParseElement(XmlNode element) | ||
280 | { | ||
281 | Dictionary<string, object> ret = new Dictionary<string, object>(); | ||
282 | |||
283 | XmlNodeList partL = element.ChildNodes; | ||
284 | |||
285 | foreach (XmlNode part in partL) | ||
286 | { | ||
287 | XmlNode type = part.Attributes.GetNamedItem("Type"); | ||
288 | if (type == null || type.Value != "List") | ||
289 | { | ||
290 | ret[part.Name] = part.InnerText; | ||
291 | } | ||
292 | else | ||
293 | { | ||
294 | ret[part.Name] = ParseElement(part); | ||
295 | } | ||
296 | } | ||
297 | |||
298 | return ret; | ||
299 | } | ||
258 | } | 300 | } |
259 | } | 301 | } |
diff --git a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs index 6cf7d56..490a13a 100644 --- a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs | |||
@@ -157,7 +157,7 @@ namespace OpenSim.Server.Handlers.Authentication | |||
157 | 157 | ||
158 | doc.AppendChild(xmlnode); | 158 | doc.AppendChild(xmlnode); |
159 | 159 | ||
160 | XmlElement rootElement = doc.CreateElement("", "Authentication", | 160 | XmlElement rootElement = doc.CreateElement("", "ServerResponse", |
161 | ""); | 161 | ""); |
162 | 162 | ||
163 | doc.AppendChild(rootElement); | 163 | doc.AppendChild(rootElement); |
@@ -179,7 +179,7 @@ namespace OpenSim.Server.Handlers.Authentication | |||
179 | 179 | ||
180 | doc.AppendChild(xmlnode); | 180 | doc.AppendChild(xmlnode); |
181 | 181 | ||
182 | XmlElement rootElement = doc.CreateElement("", "Authentication", | 182 | XmlElement rootElement = doc.CreateElement("", "ServerResponse", |
183 | ""); | 183 | ""); |
184 | 184 | ||
185 | doc.AppendChild(rootElement); | 185 | doc.AppendChild(rootElement); |
@@ -201,7 +201,7 @@ namespace OpenSim.Server.Handlers.Authentication | |||
201 | 201 | ||
202 | doc.AppendChild(xmlnode); | 202 | doc.AppendChild(xmlnode); |
203 | 203 | ||
204 | XmlElement rootElement = doc.CreateElement("", "Authentication", | 204 | XmlElement rootElement = doc.CreateElement("", "ServerResponse", |
205 | ""); | 205 | ""); |
206 | 206 | ||
207 | doc.AppendChild(rootElement); | 207 | doc.AppendChild(rootElement); |
diff --git a/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs index 053d27c..35f96a1 100644 --- a/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs | |||
@@ -35,6 +35,7 @@ using OpenSim.Framework; | |||
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
36 | using OpenSim.Framework.Servers.HttpServer; | 36 | using OpenSim.Framework.Servers.HttpServer; |
37 | using OpenSim.Services.Interfaces; | 37 | using OpenSim.Services.Interfaces; |
38 | using OpenSim.Server.Base; | ||
38 | using OpenMetaverse; | 39 | using OpenMetaverse; |
39 | 40 | ||
40 | namespace OpenSim.Services.Connectors | 41 | namespace OpenSim.Services.Connectors |
@@ -83,6 +84,17 @@ namespace OpenSim.Services.Connectors | |||
83 | 84 | ||
84 | public string Authenticate(UUID principalID, string password, int lifetime) | 85 | public string Authenticate(UUID principalID, string password, int lifetime) |
85 | { | 86 | { |
87 | Dictionary<string, string> sendData = new Dictionary<string, string>(); | ||
88 | sendData["LIFETIME"] = lifetime.ToString(); | ||
89 | sendData["PRINCIPAL"] = principalID.ToString(); | ||
90 | sendData["PASSWORD"] = password; | ||
91 | |||
92 | sendData["METHOD"] = "authenticate"; | ||
93 | |||
94 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
95 | m_ServerURI + "/auth/plain", | ||
96 | ServerUtils.BuildQueryString(sendData)); | ||
97 | |||
86 | return String.Empty; | 98 | return String.Empty; |
87 | } | 99 | } |
88 | 100 | ||