Implement region registration with authentication

slimupdates
Melanie 2010-01-15 21:57:31 +00:00
parent d49cc7ca90
commit 686660650b
3 changed files with 24 additions and 1 deletions

View File

@ -34,6 +34,7 @@ using log4net;
using OpenSim.Framework;
using OpenSim.Framework.Console;
using OpenSim.Data;
using OpenSim.Server.Base;
using OpenSim.Services.Interfaces;
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using OpenMetaverse;
@ -50,6 +51,8 @@ namespace OpenSim.Services.GridService
private static GridService m_RootInstance = null;
protected IConfigSource m_config;
protected IAuthenticationService m_AuthenticationService = null;
public GridService(IConfigSource config)
: base(config)
{
@ -60,6 +63,14 @@ namespace OpenSim.Services.GridService
if (gridConfig != null)
{
m_DeleteOnUnregister = gridConfig.GetBoolean("DeleteOnUnregister", true);
string authService = gridConfig.GetString("AuthenticationService", String.Empty);
if (authService != String.Empty)
{
Object[] args = new Object[] { config };
m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, args);
}
}
if (m_RootInstance == null)
@ -118,7 +129,13 @@ namespace OpenSim.Services.GridService
if ((rflags & OpenSim.Data.RegionFlags.Authenticate) != 0)
{
// TODO: Authenticate the principal
// Can we authenticate at all?
//
if (m_AuthenticationService == null)
return false;
if (!m_AuthenticationService.Verify(new UUID(region.Data["PrincipalID"].ToString()), regionInfos.Token, 30))
return false;
return false;
}

View File

@ -159,6 +159,7 @@ namespace OpenSim.Services.Interfaces
public byte Access;
public int Maturity;
public string RegionSecret;
public string Token;
public GridRegion()
{
@ -306,6 +307,7 @@ namespace OpenSim.Services.Interfaces
kvp["access"] = Access.ToString();
kvp["regionSecret"] = RegionSecret;
kvp["owner_uuid"] = EstateOwner.ToString();
kvp["token"] = Token.ToString();
// Maturity doesn't seem to exist in the DB
return kvp;
}
@ -363,6 +365,9 @@ namespace OpenSim.Services.Interfaces
if (kvp.ContainsKey("owner_uuid"))
EstateOwner = new UUID(kvp["owner_uuid"].ToString());
if (kvp.ContainsKey("token"))
Token = kvp["token"].ToString();
}
}

View File

@ -1056,6 +1056,7 @@
<Reference name="OpenSim.Services.Base"/>
<Reference name="OpenSim.Services.Connectors"/>
<Reference name="OpenSim.Data"/>
<Reference name="OpenSim.Server.Base"/>
<Reference name="Nini.dll" />
<Reference name="log4net.dll"/>