Separated Login Service from usermanager, which helps to clean up the code a bit and also should help to integrate the inventory server (when it is wrote/finished).
parent
dc24317678
commit
04b1767886
|
@ -338,248 +338,6 @@ namespace OpenSim.Framework.UserManagement
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Checks a user against it's password hash
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="profile">The users profile</param>
|
|
||||||
/// <param name="password">The supplied password</param>
|
|
||||||
/// <returns>Authenticated?</returns>
|
|
||||||
public virtual bool AuthenticateUser(UserProfileData profile, string password)
|
|
||||||
{
|
|
||||||
MainLog.Instance.Verbose(
|
|
||||||
"Authenticating " + profile.username + " " + profile.surname);
|
|
||||||
|
|
||||||
password = password.Remove(0, 3); //remove $1$
|
|
||||||
|
|
||||||
string s = Util.Md5Hash(password + ":" + profile.passwordSalt);
|
|
||||||
|
|
||||||
return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Xml Response
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="firstname"></param>
|
|
||||||
/// <param name="lastname"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public virtual UserProfileData GetTheUser(string firstname, string lastname)
|
|
||||||
{
|
|
||||||
return getUserProfile(firstname, lastname);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public virtual string GetMessage()
|
|
||||||
{
|
|
||||||
return _config.DefaultStartupMsg;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
protected virtual ArrayList GetInventoryLibrary()
|
|
||||||
{
|
|
||||||
//return new ArrayList();
|
|
||||||
Hashtable TempHash = new Hashtable();
|
|
||||||
TempHash["name"] = "OpenSim Library";
|
|
||||||
TempHash["parent_id"] = LLUUID.Zero.ToStringHyphenated();
|
|
||||||
TempHash["version"] = "1";
|
|
||||||
TempHash["type_default"] = "-1";
|
|
||||||
TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba000";
|
|
||||||
ArrayList temp = new ArrayList();
|
|
||||||
temp.Add(TempHash);
|
|
||||||
|
|
||||||
TempHash = new Hashtable();
|
|
||||||
TempHash["name"] = "Texture Library";
|
|
||||||
TempHash["parent_id"] = "00000112-000f-0000-0000-000100bba000";
|
|
||||||
TempHash["version"] = "1";
|
|
||||||
TempHash["type_default"] = "-1";
|
|
||||||
TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba001";
|
|
||||||
temp.Add(TempHash);
|
|
||||||
return temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
protected virtual ArrayList GetLibraryOwner()
|
|
||||||
{
|
|
||||||
//for now create random inventory library owner
|
|
||||||
Hashtable TempHash = new Hashtable();
|
|
||||||
TempHash["agent_id"] = "11111111-1111-0000-0000-000100bba000";
|
|
||||||
ArrayList inventoryLibOwner = new ArrayList();
|
|
||||||
inventoryLibOwner.Add(TempHash);
|
|
||||||
return inventoryLibOwner;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual AgentInventory GetUsersInventory(LLUUID agentID)
|
|
||||||
{
|
|
||||||
AgentInventory userInventory = new AgentInventory();
|
|
||||||
userInventory.CreateRootFolder(agentID, false);
|
|
||||||
|
|
||||||
return userInventory;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual ArrayList CreateInventoryArray(AgentInventory userInventory)
|
|
||||||
{
|
|
||||||
ArrayList AgentInventoryArray = new ArrayList();
|
|
||||||
Hashtable TempHash;
|
|
||||||
foreach (InventoryFolder InvFolder in userInventory.InventoryFolders.Values)
|
|
||||||
{
|
|
||||||
TempHash = new Hashtable();
|
|
||||||
TempHash["name"] = InvFolder.FolderName;
|
|
||||||
TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
|
|
||||||
TempHash["version"] = (Int32)InvFolder.Version;
|
|
||||||
TempHash["type_default"] = (Int32)InvFolder.DefaultType;
|
|
||||||
TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
|
|
||||||
AgentInventoryArray.Add(TempHash);
|
|
||||||
}
|
|
||||||
return AgentInventoryArray;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Customises the login response and fills in missing values.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="response">The existing response</param>
|
|
||||||
/// <param name="theUser">The user profile</param>
|
|
||||||
public abstract void CustomiseResponse( LoginResponse response, UserProfileData theUser);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Main user login function
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="request">The XMLRPC request</param>
|
|
||||||
/// <returns>The response to send</returns>
|
|
||||||
public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
|
|
||||||
{
|
|
||||||
|
|
||||||
System.Console.WriteLine("Attempting login now...");
|
|
||||||
XmlRpcResponse response = new XmlRpcResponse();
|
|
||||||
Hashtable requestData = (Hashtable)request.Params[0];
|
|
||||||
|
|
||||||
bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd"));
|
|
||||||
bool GoodLogin = false;
|
|
||||||
string firstname = "";
|
|
||||||
string lastname = "";
|
|
||||||
string passwd = "";
|
|
||||||
|
|
||||||
UserProfileData userProfile;
|
|
||||||
LoginResponse logResponse = new LoginResponse();
|
|
||||||
|
|
||||||
if (GoodXML)
|
|
||||||
{
|
|
||||||
firstname = (string)requestData["first"];
|
|
||||||
lastname = (string)requestData["last"];
|
|
||||||
passwd = (string)requestData["passwd"];
|
|
||||||
|
|
||||||
userProfile = GetTheUser(firstname, lastname);
|
|
||||||
if (userProfile == null)
|
|
||||||
return logResponse.CreateLoginFailedResponse();
|
|
||||||
|
|
||||||
GoodLogin = AuthenticateUser(userProfile, passwd);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return logResponse.CreateGridErrorResponse();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!GoodLogin)
|
|
||||||
{
|
|
||||||
return logResponse.CreateLoginFailedResponse();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// If we already have a session...
|
|
||||||
if (userProfile.currentAgent != null && userProfile.currentAgent.agentOnline)
|
|
||||||
{
|
|
||||||
// Reject the login
|
|
||||||
return logResponse.CreateAlreadyLoggedInResponse();
|
|
||||||
}
|
|
||||||
// Otherwise...
|
|
||||||
// Create a new agent session
|
|
||||||
CreateAgent( userProfile, request);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
LLUUID agentID = userProfile.UUID;
|
|
||||||
|
|
||||||
// Inventory Library Section
|
|
||||||
AgentInventory userInventory = this.GetUsersInventory(agentID);
|
|
||||||
ArrayList AgentInventoryArray = this.CreateInventoryArray(userInventory);
|
|
||||||
|
|
||||||
Hashtable InventoryRootHash = new Hashtable();
|
|
||||||
InventoryRootHash["folder_id"] = userInventory.InventoryRoot.FolderID.ToStringHyphenated();
|
|
||||||
ArrayList InventoryRoot = new ArrayList();
|
|
||||||
InventoryRoot.Add(InventoryRootHash);
|
|
||||||
userProfile.rootInventoryFolderID = userInventory.InventoryRoot.FolderID;
|
|
||||||
|
|
||||||
// Circuit Code
|
|
||||||
uint circode = (uint)(Util.RandomClass.Next());
|
|
||||||
|
|
||||||
logResponse.Lastname = userProfile.surname;
|
|
||||||
logResponse.Firstname = userProfile.username;
|
|
||||||
logResponse.AgentID = agentID.ToStringHyphenated();
|
|
||||||
logResponse.SessionID = userProfile.currentAgent.sessionID.ToStringHyphenated();
|
|
||||||
logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated();
|
|
||||||
logResponse.InventoryRoot = InventoryRoot;
|
|
||||||
logResponse.InventorySkeleton = AgentInventoryArray;
|
|
||||||
logResponse.InventoryLibrary = this.GetInventoryLibrary();
|
|
||||||
logResponse.InventoryLibraryOwner = this.GetLibraryOwner();
|
|
||||||
logResponse.CircuitCode = (Int32)circode;
|
|
||||||
//logResponse.RegionX = 0; //overwritten
|
|
||||||
//logResponse.RegionY = 0; //overwritten
|
|
||||||
logResponse.Home = "!!null temporary value {home}!!"; // Overwritten
|
|
||||||
//logResponse.LookAt = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n";
|
|
||||||
//logResponse.SimAddress = "127.0.0.1"; //overwritten
|
|
||||||
//logResponse.SimPort = 0; //overwritten
|
|
||||||
logResponse.Message = this.GetMessage();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
this.CustomiseResponse( logResponse, userProfile);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
System.Console.WriteLine(e.ToString());
|
|
||||||
return logResponse.CreateDeadRegionResponse();
|
|
||||||
//return logResponse.ToXmlRpcResponse();
|
|
||||||
}
|
|
||||||
CommitAgent(ref userProfile);
|
|
||||||
return logResponse.ToXmlRpcResponse();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
catch (Exception E)
|
|
||||||
{
|
|
||||||
System.Console.WriteLine(E.ToString());
|
|
||||||
}
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
return response;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Deletes an active agent session
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="request">The request</param>
|
|
||||||
/// <param name="path">The path (eg /bork/narf/test)</param>
|
|
||||||
/// <param name="param">Parameters sent</param>
|
|
||||||
/// <returns>Success "OK" else error</returns>
|
|
||||||
public string RestDeleteUserSessionMethod(string request, string path, string param)
|
|
||||||
{
|
|
||||||
// TODO! Important!
|
|
||||||
|
|
||||||
return "OK";
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -611,6 +369,22 @@ namespace OpenSim.Framework.UserManagement
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Rest and XML-RPC methods. (could move them to a sub class in the user server?)
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes an active agent session
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">The request</param>
|
||||||
|
/// <param name="path">The path (eg /bork/narf/test)</param>
|
||||||
|
/// <param name="param">Parameters sent</param>
|
||||||
|
/// <returns>Success "OK" else error</returns>
|
||||||
|
public string RestDeleteUserSessionMethod(string request, string path, string param)
|
||||||
|
{
|
||||||
|
// TODO! Important!
|
||||||
|
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns an error message that the user could not be found in the database
|
/// Returns an error message that the user could not be found in the database
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -47,6 +47,7 @@ namespace OpenSim.Grid.UserServer
|
||||||
private UserConfig Cfg;
|
private UserConfig Cfg;
|
||||||
|
|
||||||
public UserManager m_userManager;
|
public UserManager m_userManager;
|
||||||
|
public UserLoginService m_loginService;
|
||||||
|
|
||||||
public Dictionary<LLUUID, UserProfile> UserSessions = new Dictionary<LLUUID, UserProfile>();
|
public Dictionary<LLUUID, UserProfile> UserSessions = new Dictionary<LLUUID, UserProfile>();
|
||||||
|
|
||||||
|
@ -92,10 +93,12 @@ namespace OpenSim.Grid.UserServer
|
||||||
m_userManager._config = Cfg;
|
m_userManager._config = Cfg;
|
||||||
m_userManager.AddPlugin(Cfg.DatabaseProvider);
|
m_userManager.AddPlugin(Cfg.DatabaseProvider);
|
||||||
|
|
||||||
|
m_loginService = new UserLoginService(m_userManager, Cfg, Cfg.DefaultStartupMsg);
|
||||||
|
|
||||||
MainLog.Instance.Verbose("Main.cs:Startup() - Starting HTTP process");
|
MainLog.Instance.Verbose("Main.cs:Startup() - Starting HTTP process");
|
||||||
BaseHttpServer httpServer = new BaseHttpServer(8002);
|
BaseHttpServer httpServer = new BaseHttpServer(8002);
|
||||||
|
|
||||||
httpServer.AddXmlRPCHandler("login_to_simulator", m_userManager.XmlRpcLoginMethod);
|
httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod);
|
||||||
|
|
||||||
httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName);
|
httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName);
|
||||||
httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID);
|
httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID);
|
||||||
|
|
|
@ -41,61 +41,6 @@ namespace OpenSim.Grid.UserServer
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Customises the login response and fills in missing values.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="response">The existing response</param>
|
|
||||||
/// <param name="theUser">The user profile</param>
|
|
||||||
public override void CustomiseResponse( LoginResponse response, UserProfileData theUser)
|
|
||||||
{
|
|
||||||
// Load information from the gridserver
|
|
||||||
SimProfileData SimInfo = new SimProfileData();
|
|
||||||
SimInfo = SimInfo.RequestSimProfileData(theUser.currentAgent.currentHandle, _config.GridServerURL, _config.GridSendKey, _config.GridRecvKey);
|
|
||||||
|
|
||||||
// Customise the response
|
|
||||||
// Home Location
|
|
||||||
response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * 256).ToString() + ",r" + (SimInfo.regionLocY * 256).ToString() + "], " +
|
|
||||||
"'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
|
|
||||||
"'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}";
|
|
||||||
|
|
||||||
// Destination
|
|
||||||
Console.WriteLine("CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + SimInfo.regionLocY);
|
|
||||||
response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString();
|
|
||||||
response.SimPort = (Int32)SimInfo.serverPort;
|
|
||||||
response.RegionX = SimInfo.regionLocX;
|
|
||||||
response.RegionY = SimInfo.regionLocY;
|
|
||||||
|
|
||||||
//Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI
|
|
||||||
string capsPath = Util.GetRandomCapsPath();
|
|
||||||
response.SeedCapability = SimInfo.httpServerURI + "CAPS/" + capsPath + "0000/";
|
|
||||||
|
|
||||||
// Notify the target of an incoming user
|
|
||||||
Console.WriteLine("Notifying " + SimInfo.regionName + " (" + SimInfo.serverURI+ ")");
|
|
||||||
|
|
||||||
// Prepare notification
|
|
||||||
Hashtable SimParams = new Hashtable();
|
|
||||||
SimParams["session_id"] = theUser.currentAgent.sessionID.ToString();
|
|
||||||
SimParams["secure_session_id"] = theUser.currentAgent.secureSessionID.ToString();
|
|
||||||
SimParams["firstname"] = theUser.username;
|
|
||||||
SimParams["lastname"] = theUser.surname;
|
|
||||||
SimParams["agent_id"] = theUser.UUID.ToString();
|
|
||||||
SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode);
|
|
||||||
SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString();
|
|
||||||
SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString();
|
|
||||||
SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString();
|
|
||||||
SimParams["regionhandle"] = theUser.currentAgent.currentHandle.ToString();
|
|
||||||
SimParams["caps_path"] = capsPath;
|
|
||||||
ArrayList SendParams = new ArrayList();
|
|
||||||
SendParams.Add(SimParams);
|
|
||||||
|
|
||||||
// Update agent with target sim
|
|
||||||
theUser.currentAgent.currentRegion = SimInfo.UUID;
|
|
||||||
theUser.currentAgent.currentHandle = SimInfo.regionHandle;
|
|
||||||
|
|
||||||
System.Console.WriteLine("Informing region --> " + SimInfo.httpServerURI);
|
|
||||||
// Send
|
|
||||||
XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
|
|
||||||
XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 3000);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,23 +37,25 @@ namespace OpenSim.Region.Communications.Local
|
||||||
{
|
{
|
||||||
public class CommunicationsLocal : CommunicationsManager
|
public class CommunicationsLocal : CommunicationsManager
|
||||||
{
|
{
|
||||||
public LocalBackEndServices SandBoxServices = new LocalBackEndServices();
|
public LocalBackEndServices InstanceServices = new LocalBackEndServices();
|
||||||
public LocalUserServices UserServices;
|
public LocalUserServices UserServices;
|
||||||
|
public LocalLoginService LoginServices;
|
||||||
|
|
||||||
public CommunicationsLocal(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache, bool accountsAuthenticate, string welcomeMessage )
|
public CommunicationsLocal(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache, bool accountsAuthenticate, string welcomeMessage )
|
||||||
: base(serversInfo, httpServer, assetCache)
|
: base(serversInfo, httpServer, assetCache)
|
||||||
{
|
{
|
||||||
UserServices = new LocalUserServices(this, serversInfo, accountsAuthenticate, welcomeMessage);
|
UserServices = new LocalUserServices(this, serversInfo);
|
||||||
UserServices.AddPlugin("OpenSim.Framework.Data.DB4o.dll");
|
UserServices.AddPlugin("OpenSim.Framework.Data.DB4o.dll");
|
||||||
UserServer = UserServices;
|
UserServer = UserServices;
|
||||||
GridServer = SandBoxServices;
|
GridServer = InstanceServices;
|
||||||
InterRegion = SandBoxServices;
|
InterRegion = InstanceServices;
|
||||||
httpServer.AddXmlRPCHandler("login_to_simulator", UserServices.XmlRpcLoginMethod);
|
LoginServices = new LocalLoginService(UserServices, welcomeMessage, this, serversInfo, accountsAuthenticate);
|
||||||
|
httpServer.AddXmlRPCHandler("login_to_simulator", LoginServices.XmlRpcLoginMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void InformRegionOfLogin(ulong regionHandle, Login login)
|
internal void InformRegionOfLogin(ulong regionHandle, Login login)
|
||||||
{
|
{
|
||||||
this.SandBoxServices.AddNewSession(regionHandle, login);
|
this.InstanceServices.AddNewSession(regionHandle, login);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doCreate(string what)
|
public void doCreate(string what)
|
||||||
|
|
|
@ -15,20 +15,14 @@ namespace OpenSim.Region.Communications.Local
|
||||||
private NetworkServersInfo serversInfo;
|
private NetworkServersInfo serversInfo;
|
||||||
private uint defaultHomeX ;
|
private uint defaultHomeX ;
|
||||||
private uint defaultHomeY;
|
private uint defaultHomeY;
|
||||||
private bool authUsers = false;
|
|
||||||
private string welcomeMessage = "Welcome to OpenSim";
|
|
||||||
|
|
||||||
public LocalUserServices(CommunicationsLocal parent, NetworkServersInfo serversInfo, bool authenticate, string welcomeMess)
|
|
||||||
|
public LocalUserServices(CommunicationsLocal parent, NetworkServersInfo serversInfo)
|
||||||
{
|
{
|
||||||
m_Parent = parent;
|
m_Parent = parent;
|
||||||
this.serversInfo = serversInfo;
|
this.serversInfo = serversInfo;
|
||||||
defaultHomeX = this.serversInfo.DefaultHomeLocX;
|
defaultHomeX = this.serversInfo.DefaultHomeLocX;
|
||||||
defaultHomeY = this.serversInfo.DefaultHomeLocY;
|
defaultHomeY = this.serversInfo.DefaultHomeLocY;
|
||||||
this.authUsers = authenticate;
|
|
||||||
if (welcomeMess != "")
|
|
||||||
{
|
|
||||||
this.welcomeMessage = welcomeMess;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserProfileData GetUserProfile(string firstName, string lastName)
|
public UserProfileData GetUserProfile(string firstName, string lastName)
|
||||||
|
@ -46,97 +40,6 @@ namespace OpenSim.Region.Communications.Local
|
||||||
return this.getUserProfile(avatarID);
|
return this.getUserProfile(avatarID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public override string GetMessage()
|
|
||||||
{
|
|
||||||
return welcomeMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override UserProfileData GetTheUser(string firstname, string lastname)
|
|
||||||
{
|
|
||||||
UserProfileData profile = getUserProfile(firstname, lastname);
|
|
||||||
if (profile != null)
|
|
||||||
{
|
|
||||||
|
|
||||||
return profile;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!authUsers)
|
|
||||||
{
|
|
||||||
//no current user account so make one
|
|
||||||
Console.WriteLine("No User account found so creating a new one ");
|
|
||||||
this.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY);
|
|
||||||
|
|
||||||
profile = getUserProfile(firstname, lastname);
|
|
||||||
|
|
||||||
return profile;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool AuthenticateUser(UserProfileData profile, string password)
|
|
||||||
{
|
|
||||||
if (!authUsers)
|
|
||||||
{
|
|
||||||
//for now we will accept any password in sandbox mode
|
|
||||||
Console.WriteLine("authorising user");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Console.WriteLine( "Authenticating " + profile.username + " " + profile.surname);
|
|
||||||
|
|
||||||
password = password.Remove(0, 3); //remove $1$
|
|
||||||
|
|
||||||
string s = Util.Md5Hash(password + ":" + profile.passwordSalt);
|
|
||||||
|
|
||||||
return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void CustomiseResponse(LoginResponse response, UserProfileData theUser)
|
|
||||||
{
|
|
||||||
ulong currentRegion = theUser.currentAgent.currentHandle;
|
|
||||||
RegionInfo reg = m_Parent.GridServer.RequestNeighbourInfo(currentRegion);
|
|
||||||
|
|
||||||
if (reg != null)
|
|
||||||
{
|
|
||||||
response.Home = "{'region_handle':[r" + (reg.RegionLocX * 256).ToString() + ",r" + (reg.RegionLocY * 256).ToString() + "], " +
|
|
||||||
"'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
|
|
||||||
"'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}";
|
|
||||||
string capsPath = Util.GetRandomCapsPath();
|
|
||||||
response.SimAddress = reg.ExternalEndPoint.Address.ToString();
|
|
||||||
response.SimPort = (Int32)reg.ExternalEndPoint.Port;
|
|
||||||
response.RegionX = reg.RegionLocX ;
|
|
||||||
response.RegionY = reg.RegionLocY ;
|
|
||||||
|
|
||||||
//following port needs changing as we don't want a http listener for every region (or do we?)
|
|
||||||
response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CAPS/" + capsPath + "0000/";
|
|
||||||
theUser.currentAgent.currentRegion = reg.SimUUID;
|
|
||||||
theUser.currentAgent.currentHandle = reg.RegionHandle;
|
|
||||||
|
|
||||||
Login _login = new Login();
|
|
||||||
//copy data to login object
|
|
||||||
_login.First = response.Firstname;
|
|
||||||
_login.Last = response.Lastname;
|
|
||||||
_login.Agent = response.AgentID;
|
|
||||||
_login.Session = response.SessionID;
|
|
||||||
_login.SecureSession = response.SecureSessionID;
|
|
||||||
_login.CircuitCode = (uint)response.CircuitCode;
|
|
||||||
_login.CapsPath = capsPath;
|
|
||||||
|
|
||||||
m_Parent.InformRegionOfLogin(currentRegion, _login);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Console.WriteLine("not found region " + currentRegion);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public UserProfileData SetupMasterUser(string firstName, string lastName)
|
public UserProfileData SetupMasterUser(string firstName, string lastName)
|
||||||
{
|
{
|
||||||
return SetupMasterUser(firstName, lastName, "");
|
return SetupMasterUser(firstName, lastName, "");
|
||||||
|
|
Loading…
Reference in New Issue