Implemented initial login code for the management agent

TODO: crypto-secure random session ID, data providers - HELP ME JEBUS (Or Adam)
zircon^2
gareth 2007-05-17 07:35:27 +00:00
parent 0120938f7a
commit 6ddc0f4c39
1 changed files with 24 additions and 0 deletions

View File

@ -1,6 +1,8 @@
using Nwc.XmlRpc;
using OpenSim.Framework;
using OpenSim.Servers;
using System.Collections;
using System.Collections.Generic;
namespace OpenGrid.Framework.Manager {
@ -20,6 +22,8 @@ namespace OpenGrid.Framework.Manager {
this.component_type=component_type;
this.thecallback=thecallback;
app_httpd.AddXmlRPCHandler("manager_login",XmlRpcLoginMethod);
switch(component_type)
{
case "gridserver":
@ -31,5 +35,25 @@ namespace OpenGrid.Framework.Manager {
}
}
public static XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
{
XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable)request.Params[0];
Hashtable responseData = new Hashtable();
// TODO: Switch this over to using OpenGrid.Framework.Data
if( requestData["username"].Equals("admin") && requestData["password"].Equals("supersecret")) {
response.IsFault=false;
responseData["msg"]="Login OK";
} else {
response.IsFault=true;
responseData["error"]="Invalid username or password";
}
response.Value = responseData;
return response;
}
}
}