diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 68269402b6..5c55c0b473 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -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(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; } diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index cd27145ee7..6b6b34797a 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs @@ -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(); + } } diff --git a/prebuild.xml b/prebuild.xml index fbb782a750..284913a68c 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -1056,6 +1056,7 @@ +