diff options
Diffstat (limited to 'OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs')
-rw-r--r-- | OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs b/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs index 33dc301..55ae6db 100644 --- a/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs +++ b/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs | |||
@@ -36,6 +36,7 @@ using OpenSim.Framework; | |||
36 | using OpenSim.Server.Base; | 36 | using OpenSim.Server.Base; |
37 | using OpenSim.Services.Interfaces; | 37 | using OpenSim.Services.Interfaces; |
38 | using OpenSim.Framework.Servers.HttpServer; | 38 | using OpenSim.Framework.Servers.HttpServer; |
39 | using OpenSim.Framework.ServiceAuth; | ||
39 | using OpenSim.Server.Handlers.Base; | 40 | using OpenSim.Server.Handlers.Base; |
40 | using log4net; | 41 | using log4net; |
41 | using OpenMetaverse; | 42 | using OpenMetaverse; |
@@ -69,7 +70,9 @@ namespace OpenSim.Groups | |||
69 | 70 | ||
70 | m_GroupsService = new GroupsService(config); | 71 | m_GroupsService = new GroupsService(config); |
71 | 72 | ||
72 | server.AddStreamHandler(new GroupsServicePostHandler(m_GroupsService, key)); | 73 | IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); |
74 | |||
75 | server.AddStreamHandler(new GroupsServicePostHandler(m_GroupsService, auth)); | ||
73 | } | 76 | } |
74 | } | 77 | } |
75 | 78 | ||
@@ -78,13 +81,11 @@ namespace OpenSim.Groups | |||
78 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 81 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
79 | 82 | ||
80 | private GroupsService m_GroupsService; | 83 | private GroupsService m_GroupsService; |
81 | private string m_SecretKey = String.Empty; | ||
82 | 84 | ||
83 | public GroupsServicePostHandler(GroupsService service, string key) : | 85 | public GroupsServicePostHandler(GroupsService service, IServiceAuth auth) : |
84 | base("POST", "/groups") | 86 | base("POST", "/groups", auth) |
85 | { | 87 | { |
86 | m_GroupsService = service; | 88 | m_GroupsService = service; |
87 | m_SecretKey = key; | ||
88 | } | 89 | } |
89 | 90 | ||
90 | protected override byte[] ProcessRequest(string path, Stream requestData, | 91 | protected override byte[] ProcessRequest(string path, Stream requestData, |
@@ -108,20 +109,6 @@ namespace OpenSim.Groups | |||
108 | string method = request["METHOD"].ToString(); | 109 | string method = request["METHOD"].ToString(); |
109 | request.Remove("METHOD"); | 110 | request.Remove("METHOD"); |
110 | 111 | ||
111 | if (!String.IsNullOrEmpty(m_SecretKey)) // Verification required | ||
112 | { | ||
113 | // Sender didn't send key | ||
114 | if (!request.ContainsKey("KEY") || (request["KEY"] == null)) | ||
115 | return FailureResult("This service requires a secret key"); | ||
116 | |||
117 | // Sender sent wrong key | ||
118 | if (!m_SecretKey.Equals(request["KEY"])) | ||
119 | return FailureResult("Provided key does not match existing one"); | ||
120 | |||
121 | // OK, key matches. Remove it. | ||
122 | request.Remove("KEY"); | ||
123 | } | ||
124 | |||
125 | m_log.DebugFormat("[Groups.Handler]: {0}", method); | 112 | m_log.DebugFormat("[Groups.Handler]: {0}", method); |
126 | switch (method) | 113 | switch (method) |
127 | { | 114 | { |