From 04b1767886af28fa1793c46a1cbe4b3f49eefca6 Mon Sep 17 00:00:00 2001
From: MW
Date: Mon, 13 Aug 2007 15:55:36 +0000
Subject: 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).
---
.../Communications/Local/CommunicationsLocal.cs | 14 +--
.../Communications/Local/LocalUserServices.cs | 101 +--------------------
2 files changed, 10 insertions(+), 105 deletions(-)
(limited to 'OpenSim/Region/Communications/Local')
diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
index a0bbf6d..3ad33f4 100644
--- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
+++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
@@ -37,23 +37,25 @@ namespace OpenSim.Region.Communications.Local
{
public class CommunicationsLocal : CommunicationsManager
{
- public LocalBackEndServices SandBoxServices = new LocalBackEndServices();
+ public LocalBackEndServices InstanceServices = new LocalBackEndServices();
public LocalUserServices UserServices;
+ public LocalLoginService LoginServices;
public CommunicationsLocal(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache, bool accountsAuthenticate, string welcomeMessage )
: base(serversInfo, httpServer, assetCache)
{
- UserServices = new LocalUserServices(this, serversInfo, accountsAuthenticate, welcomeMessage);
+ UserServices = new LocalUserServices(this, serversInfo);
UserServices.AddPlugin("OpenSim.Framework.Data.DB4o.dll");
UserServer = UserServices;
- GridServer = SandBoxServices;
- InterRegion = SandBoxServices;
- httpServer.AddXmlRPCHandler("login_to_simulator", UserServices.XmlRpcLoginMethod);
+ GridServer = InstanceServices;
+ InterRegion = InstanceServices;
+ LoginServices = new LocalLoginService(UserServices, welcomeMessage, this, serversInfo, accountsAuthenticate);
+ httpServer.AddXmlRPCHandler("login_to_simulator", LoginServices.XmlRpcLoginMethod);
}
internal void InformRegionOfLogin(ulong regionHandle, Login login)
{
- this.SandBoxServices.AddNewSession(regionHandle, login);
+ this.InstanceServices.AddNewSession(regionHandle, login);
}
public void doCreate(string what)
diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs
index 63f8c21..65732bd 100644
--- a/OpenSim/Region/Communications/Local/LocalUserServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalUserServices.cs
@@ -15,20 +15,14 @@ namespace OpenSim.Region.Communications.Local
private NetworkServersInfo serversInfo;
private uint defaultHomeX ;
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;
this.serversInfo = serversInfo;
defaultHomeX = this.serversInfo.DefaultHomeLocX;
defaultHomeY = this.serversInfo.DefaultHomeLocY;
- this.authUsers = authenticate;
- if (welcomeMess != "")
- {
- this.welcomeMessage = welcomeMess;
- }
}
public UserProfileData GetUserProfile(string firstName, string lastName)
@@ -46,97 +40,6 @@ namespace OpenSim.Region.Communications.Local
return this.getUserProfile(avatarID);
}
- ///
- ///
- ///
- ///
- 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)
{
return SetupMasterUser(firstName, lastName, "");
--
cgit v1.1