From 686660650b4f5724fc0b4858d50ff4deeafb8ffe Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 15 Jan 2010 21:57:31 +0000 Subject: Implement region registration with authentication --- OpenSim/Services/GridService/GridService.cs | 19 ++++++++++++++++++- OpenSim/Services/Interfaces/IGridService.cs | 5 +++++ 2 files changed, 23 insertions(+), 1 deletion(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 6826940..5c55c0b 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 cd27145..6b6b347 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(); + } } -- cgit v1.1