aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
authorMelanie2010-01-15 21:57:31 +0000
committerMelanie2010-01-15 21:57:31 +0000
commit686660650b4f5724fc0b4858d50ff4deeafb8ffe (patch)
tree95b0ac4ee95239d6443f8e11e79bd7d60ed5e35a /OpenSim/Services
parentImplement "Reservation" flag behavior. (diff)
downloadopensim-SC_OLD-686660650b4f5724fc0b4858d50ff4deeafb8ffe.zip
opensim-SC_OLD-686660650b4f5724fc0b4858d50ff4deeafb8ffe.tar.gz
opensim-SC_OLD-686660650b4f5724fc0b4858d50ff4deeafb8ffe.tar.bz2
opensim-SC_OLD-686660650b4f5724fc0b4858d50ff4deeafb8ffe.tar.xz
Implement region registration with authentication
Diffstat (limited to 'OpenSim/Services')
-rw-r--r--OpenSim/Services/GridService/GridService.cs19
-rw-r--r--OpenSim/Services/Interfaces/IGridService.cs5
2 files changed, 23 insertions, 1 deletions
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;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Console; 35using OpenSim.Framework.Console;
36using OpenSim.Data; 36using OpenSim.Data;
37using OpenSim.Server.Base;
37using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
38using GridRegion = OpenSim.Services.Interfaces.GridRegion; 39using GridRegion = OpenSim.Services.Interfaces.GridRegion;
39using OpenMetaverse; 40using OpenMetaverse;
@@ -50,6 +51,8 @@ namespace OpenSim.Services.GridService
50 private static GridService m_RootInstance = null; 51 private static GridService m_RootInstance = null;
51 protected IConfigSource m_config; 52 protected IConfigSource m_config;
52 53
54 protected IAuthenticationService m_AuthenticationService = null;
55
53 public GridService(IConfigSource config) 56 public GridService(IConfigSource config)
54 : base(config) 57 : base(config)
55 { 58 {
@@ -60,6 +63,14 @@ namespace OpenSim.Services.GridService
60 if (gridConfig != null) 63 if (gridConfig != null)
61 { 64 {
62 m_DeleteOnUnregister = gridConfig.GetBoolean("DeleteOnUnregister", true); 65 m_DeleteOnUnregister = gridConfig.GetBoolean("DeleteOnUnregister", true);
66
67 string authService = gridConfig.GetString("AuthenticationService", String.Empty);
68
69 if (authService != String.Empty)
70 {
71 Object[] args = new Object[] { config };
72 m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, args);
73 }
63 } 74 }
64 75
65 if (m_RootInstance == null) 76 if (m_RootInstance == null)
@@ -118,7 +129,13 @@ namespace OpenSim.Services.GridService
118 129
119 if ((rflags & OpenSim.Data.RegionFlags.Authenticate) != 0) 130 if ((rflags & OpenSim.Data.RegionFlags.Authenticate) != 0)
120 { 131 {
121 // TODO: Authenticate the principal 132 // Can we authenticate at all?
133 //
134 if (m_AuthenticationService == null)
135 return false;
136
137 if (!m_AuthenticationService.Verify(new UUID(region.Data["PrincipalID"].ToString()), regionInfos.Token, 30))
138 return false;
122 139
123 return false; 140 return false;
124 } 141 }
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
159 public byte Access; 159 public byte Access;
160 public int Maturity; 160 public int Maturity;
161 public string RegionSecret; 161 public string RegionSecret;
162 public string Token;
162 163
163 public GridRegion() 164 public GridRegion()
164 { 165 {
@@ -306,6 +307,7 @@ namespace OpenSim.Services.Interfaces
306 kvp["access"] = Access.ToString(); 307 kvp["access"] = Access.ToString();
307 kvp["regionSecret"] = RegionSecret; 308 kvp["regionSecret"] = RegionSecret;
308 kvp["owner_uuid"] = EstateOwner.ToString(); 309 kvp["owner_uuid"] = EstateOwner.ToString();
310 kvp["token"] = Token.ToString();
309 // Maturity doesn't seem to exist in the DB 311 // Maturity doesn't seem to exist in the DB
310 return kvp; 312 return kvp;
311 } 313 }
@@ -363,6 +365,9 @@ namespace OpenSim.Services.Interfaces
363 if (kvp.ContainsKey("owner_uuid")) 365 if (kvp.ContainsKey("owner_uuid"))
364 EstateOwner = new UUID(kvp["owner_uuid"].ToString()); 366 EstateOwner = new UUID(kvp["owner_uuid"].ToString());
365 367
368 if (kvp.ContainsKey("token"))
369 Token = kvp["token"].ToString();
370
366 } 371 }
367 } 372 }
368 373