Add a real_id field to the login response if impersonation is used. The wrapper

script needs this for proper logging.
avinationmerge
Melanie 2012-08-15 23:31:38 +02:00
parent 8cd4042f9e
commit c313de630f
9 changed files with 64 additions and 6 deletions

View File

@ -137,6 +137,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authentication
#region IAuthenticationService
public string Authenticate(UUID principalID, string password, int lifetime, out UUID realID)
{
// Not implemented at the regions
return string.Empty;
}
public string Authenticate(UUID principalID, string password, int lifetime)
{
// Not implemented at the regions

View File

@ -64,6 +64,15 @@ namespace OpenSim.Services.AuthenticationService
public string Authenticate(UUID principalID, string password, int lifetime)
{
UUID realID;
return Authenticate(principalID, password, lifetime, out realID);
}
public string Authenticate(UUID principalID, string password, int lifetime, out UUID realID)
{
realID = UUID.Zero;
m_log.DebugFormat("[AUTH SERVICE]: Authenticating for {0}, user account service present: {1}", principalID, m_UserAccountService != null);
AuthenticationData data = m_Database.Get(principalID);
UserAccount user = null;
@ -127,6 +136,7 @@ namespace OpenSim.Services.AuthenticationService
if (data.Data["passwordHash"].ToString() == hashed)
{
m_log.DebugFormat("[PASS AUTH]: {0} {1} impersonating {2}, proceeding with login", a.FirstName, a.LastName, principalID);
realID = a.PrincipalID;
return GetToken(principalID, lifetime);
}
// else

View File

@ -60,6 +60,13 @@ namespace OpenSim.Services.AuthenticationService
{
}
public string Authenticate(UUID principalID, string password, int lifetime, out UUID realID)
{
realID = UUID.Zero;
return Authenticate(principalID, password, lifetime);
}
public string Authenticate(UUID principalID, string password, int lifetime)
{
if (new UUID(password) == UUID.Zero)

View File

@ -54,6 +54,13 @@ namespace OpenSim.Services.AuthenticationService
}
public string Authenticate(UUID principalID, string password, int lifetime)
{
UUID realID;
return Authenticate(principalID, password, lifetime, out realID);
}
public string Authenticate(UUID principalID, string password, int lifetime, out UUID realID)
{
AuthenticationData data = m_Database.Get(principalID);
string result = String.Empty;
@ -62,7 +69,7 @@ namespace OpenSim.Services.AuthenticationService
if (data.Data.ContainsKey("webLoginKey"))
{
m_log.DebugFormat("[AUTH SERVICE]: Attempting web key authentication for PrincipalID {0}", principalID);
result = m_svcChecks["web_login_key"].Authenticate(principalID, password, lifetime);
result = m_svcChecks["web_login_key"].Authenticate(principalID, password, lifetime, out realID);
if (result == String.Empty)
{
m_log.DebugFormat("[AUTH SERVICE]: Web Login failed for PrincipalID {0}", principalID);
@ -71,12 +78,15 @@ namespace OpenSim.Services.AuthenticationService
if (result == string.Empty && data.Data.ContainsKey("passwordHash") && data.Data.ContainsKey("passwordSalt"))
{
m_log.DebugFormat("[AUTH SERVICE]: Attempting password authentication for PrincipalID {0}", principalID);
result = m_svcChecks["password"].Authenticate(principalID, password, lifetime);
result = m_svcChecks["password"].Authenticate(principalID, password, lifetime, out realID);
if (result == String.Empty)
{
m_log.DebugFormat("[AUTH SERVICE]: Password login failed for PrincipalID {0}", principalID);
}
}
realID = UUID.Zero;
if (result == string.Empty)
{
m_log.DebugFormat("[AUTH SERVICE]: Both password and webLoginKey-based authentication failed for PrincipalID {0}", principalID);
@ -89,4 +99,4 @@ namespace OpenSim.Services.AuthenticationService
return result;
}
}
}
}

View File

@ -81,6 +81,13 @@ namespace OpenSim.Services.Connectors
m_ServerURI = serviceURI;
}
public string Authenticate(UUID principalID, string password, int lifetime, out UUID realID)
{
realID = UUID.Zero;
return Authenticate(principalID, password, lifetime);
}
public string Authenticate(UUID principalID, string password, int lifetime)
{
Dictionary<string, object> sendData = new Dictionary<string, object>();

View File

@ -102,6 +102,11 @@ namespace OpenSim.Services.Connectors.SimianGrid
m_log.Info("[SIMIAN AUTH CONNECTOR]: No AuthenticationServerURI specified, disabling connector");
}
public string Authenticate(UUID principalID, string password, int lifetime, out UUID realID)
{
return Authenticate(principalID, password, lifetime);
}
public string Authenticate(UUID principalID, string password, int lifetime)
{
NameValueCollection requestArgs = new NameValueCollection

View File

@ -67,6 +67,7 @@ namespace OpenSim.Services.Interfaces
// various services.
//
string Authenticate(UUID principalID, string password, int lifetime);
string Authenticate(UUID principalID, string password, int lifetime, out UUID realID);
//////////////////////////////////////////////////////
// Verification

View File

@ -150,6 +150,7 @@ namespace OpenSim.Services.LLLoginService
private UUID agentID;
private UUID sessionID;
private UUID secureSessionID;
private UUID realID;
// Login Flags
private string dst;
@ -232,7 +233,7 @@ namespace OpenSim.Services.LLLoginService
GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, ILibraryService libService,
string where, string startlocation, Vector3 position, Vector3 lookAt, List<InventoryItemBase> gestures, string message,
GridRegion home, IPEndPoint clientIP, string mapTileURL, string profileURL, string openIDURL, string searchURL, string currency,
string DSTZone)
string DSTZone, UUID realID)
: this()
{
FillOutInventoryData(invSkel, libService);
@ -245,6 +246,7 @@ namespace OpenSim.Services.LLLoginService
AgentID = account.PrincipalID;
SessionID = aCircuit.SessionID;
SecureSessionID = aCircuit.SecureSessionID;
RealID = realID;
Message = message;
BuddList = ConvertFriendListItem(friendsList);
StartLocation = where;
@ -456,6 +458,7 @@ namespace OpenSim.Services.LLLoginService
SessionID = UUID.Random();
SecureSessionID = UUID.Random();
AgentID = UUID.Random();
RealID = UUID.Zero;
Hashtable InitialOutfitHash = new Hashtable();
InitialOutfitHash["folder_name"] = "Nightclub Female";
@ -499,6 +502,7 @@ namespace OpenSim.Services.LLLoginService
responseData["http_port"] = (Int32)SimHttpPort;
responseData["agent_id"] = AgentID.ToString();
responseData["real_id"] = RealID.ToString();
responseData["session_id"] = SessionID.ToString();
responseData["secure_session_id"] = SecureSessionID.ToString();
responseData["circuit_code"] = CircuitCode;
@ -581,6 +585,7 @@ namespace OpenSim.Services.LLLoginService
map["sim_ip"] = OSD.FromString(SimAddress);
map["agent_id"] = OSD.FromUUID(AgentID);
map["real_id"] = OSD.FromUUID(RealID);
map["session_id"] = OSD.FromUUID(SessionID);
map["secure_session_id"] = OSD.FromUUID(SecureSessionID);
map["circuit_code"] = OSD.FromInteger(CircuitCode);
@ -888,6 +893,12 @@ namespace OpenSim.Services.LLLoginService
set { secureSessionID = value; }
}
public UUID RealID
{
get { return realID; }
set { realID = value; }
}
public Int32 CircuitCode
{
get { return circuitCode; }

View File

@ -327,7 +327,8 @@ namespace OpenSim.Services.LLLoginService
if (!passwd.StartsWith("$1$"))
passwd = "$1$" + Util.Md5Hash(passwd);
passwd = passwd.Remove(0, 3); //remove $1$
string token = m_AuthenticationService.Authenticate(account.PrincipalID, passwd, 30);
UUID realID;
string token = m_AuthenticationService.Authenticate(account.PrincipalID, passwd, 30, out realID);
UUID secureSession = UUID.Zero;
if ((token == string.Empty) || (token != string.Empty && !UUID.TryParse(token, out secureSession)))
{
@ -459,7 +460,7 @@ namespace OpenSim.Services.LLLoginService
= new LLLoginResponse(
account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService,
where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP,
m_MapTileURL, m_ProfileURL, m_OpenIDURL, m_SearchURL, m_Currency, m_DSTZone);
m_MapTileURL, m_ProfileURL, m_OpenIDURL, m_SearchURL, m_Currency, m_DSTZone, realID);
m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to {0} {1}", firstName, lastName);