diff options
Diffstat (limited to '')
47 files changed, 519 insertions, 116 deletions
diff --git a/OpenSim/Framework/Communications/RestClient.cs b/OpenSim/Framework/Communications/RestClient.cs index e7f0ca8..89e6aa1 100644 --- a/OpenSim/Framework/Communications/RestClient.cs +++ b/OpenSim/Framework/Communications/RestClient.cs | |||
@@ -35,6 +35,8 @@ using System.Threading; | |||
35 | using System.Web; | 35 | using System.Web; |
36 | using log4net; | 36 | using log4net; |
37 | 37 | ||
38 | using OpenSim.Framework.ServiceAuth; | ||
39 | |||
38 | namespace OpenSim.Framework.Communications | 40 | namespace OpenSim.Framework.Communications |
39 | { | 41 | { |
40 | /// <summary> | 42 | /// <summary> |
@@ -297,7 +299,7 @@ namespace OpenSim.Framework.Communications | |||
297 | /// <summary> | 299 | /// <summary> |
298 | /// Perform a synchronous request | 300 | /// Perform a synchronous request |
299 | /// </summary> | 301 | /// </summary> |
300 | public Stream Request() | 302 | public Stream Request(IServiceAuth auth) |
301 | { | 303 | { |
302 | lock (_lock) | 304 | lock (_lock) |
303 | { | 305 | { |
@@ -307,6 +309,8 @@ namespace OpenSim.Framework.Communications | |||
307 | _request.Timeout = 200000; | 309 | _request.Timeout = 200000; |
308 | _request.Method = RequestMethod; | 310 | _request.Method = RequestMethod; |
309 | _asyncException = null; | 311 | _asyncException = null; |
312 | if (auth != null) | ||
313 | auth.AddAuthorization(_request.Headers); | ||
310 | 314 | ||
311 | // IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request); | 315 | // IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request); |
312 | try | 316 | try |
@@ -358,7 +362,7 @@ namespace OpenSim.Framework.Communications | |||
358 | } | 362 | } |
359 | } | 363 | } |
360 | 364 | ||
361 | public Stream Request(Stream src) | 365 | public Stream Request(Stream src, IServiceAuth auth) |
362 | { | 366 | { |
363 | _request = (HttpWebRequest) WebRequest.Create(buildUri()); | 367 | _request = (HttpWebRequest) WebRequest.Create(buildUri()); |
364 | _request.KeepAlive = false; | 368 | _request.KeepAlive = false; |
@@ -367,6 +371,8 @@ namespace OpenSim.Framework.Communications | |||
367 | _request.Method = RequestMethod; | 371 | _request.Method = RequestMethod; |
368 | _asyncException = null; | 372 | _asyncException = null; |
369 | _request.ContentLength = src.Length; | 373 | _request.ContentLength = src.Length; |
374 | if (auth != null) | ||
375 | auth.AddAuthorization(_request.Headers); | ||
370 | 376 | ||
371 | m_log.InfoFormat("[REST]: Request Length {0}", _request.ContentLength); | 377 | m_log.InfoFormat("[REST]: Request Length {0}", _request.ContentLength); |
372 | m_log.InfoFormat("[REST]: Sending Web Request {0}", buildUri()); | 378 | m_log.InfoFormat("[REST]: Sending Web Request {0}", buildUri()); |
@@ -384,7 +390,22 @@ namespace OpenSim.Framework.Communications | |||
384 | length = src.Read(buf, 0, 1024); | 390 | length = src.Read(buf, 0, 1024); |
385 | } | 391 | } |
386 | 392 | ||
387 | _response = (HttpWebResponse) _request.GetResponse(); | 393 | try |
394 | { | ||
395 | _response = (HttpWebResponse)_request.GetResponse(); | ||
396 | } | ||
397 | catch (WebException e) | ||
398 | { | ||
399 | m_log.WarnFormat("[REST]: Request {0} {1} failed with status {2} and message {3}", | ||
400 | RequestMethod, _request.RequestUri, e.Status, e.Message); | ||
401 | } | ||
402 | catch (Exception e) | ||
403 | { | ||
404 | m_log.WarnFormat( | ||
405 | "[REST]: Request {0} {1} failed with exception {2} {3}", | ||
406 | RequestMethod, _request.RequestUri, e.Message, e.StackTrace); | ||
407 | } | ||
408 | |||
388 | 409 | ||
389 | // IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request); | 410 | // IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request); |
390 | 411 | ||
@@ -423,7 +444,7 @@ namespace OpenSim.Framework.Communications | |||
423 | try | 444 | try |
424 | { | 445 | { |
425 | // Perform the operation; if sucessful set the result | 446 | // Perform the operation; if sucessful set the result |
426 | Stream s = Request(); | 447 | Stream s = Request(null); |
427 | ar.SetAsCompleted(s, false); | 448 | ar.SetAsCompleted(s, false); |
428 | } | 449 | } |
429 | catch (Exception e) | 450 | catch (Exception e) |
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseStreamHandler.cs b/OpenSim/Framework/Servers/HttpServer/BaseStreamHandler.cs index 252cc2a..f160734 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseStreamHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseStreamHandler.cs | |||
@@ -26,6 +26,8 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System.IO; | 28 | using System.IO; |
29 | using System.Net; | ||
30 | using OpenSim.Framework.ServiceAuth; | ||
29 | 31 | ||
30 | namespace OpenSim.Framework.Servers.HttpServer | 32 | namespace OpenSim.Framework.Servers.HttpServer |
31 | { | 33 | { |
@@ -37,15 +39,30 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
37 | /// </remarks> | 39 | /// </remarks> |
38 | public abstract class BaseStreamHandler : BaseRequestHandler, IStreamedRequestHandler | 40 | public abstract class BaseStreamHandler : BaseRequestHandler, IStreamedRequestHandler |
39 | { | 41 | { |
40 | protected BaseStreamHandler(string httpMethod, string path) : this(httpMethod, path, null, null) {} | 42 | protected IServiceAuth m_Auth; |
43 | |||
44 | protected BaseStreamHandler(string httpMethod, string path) : this(httpMethod, path, null, null) { } | ||
41 | 45 | ||
42 | protected BaseStreamHandler(string httpMethod, string path, string name, string description) | 46 | protected BaseStreamHandler(string httpMethod, string path, string name, string description) |
43 | : base(httpMethod, path, name, description) {} | 47 | : base(httpMethod, path, name, description) {} |
44 | 48 | ||
49 | protected BaseStreamHandler(string httpMethod, string path, IServiceAuth auth) | ||
50 | : base(httpMethod, path, null, null) | ||
51 | { | ||
52 | m_Auth = auth; | ||
53 | } | ||
54 | |||
45 | public virtual byte[] Handle( | 55 | public virtual byte[] Handle( |
46 | string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 56 | string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
47 | { | 57 | { |
48 | RequestsReceived++; | 58 | RequestsReceived++; |
59 | if (m_Auth != null && !m_Auth.Authenticate(httpRequest.Headers, httpResponse.AddHeader)) | ||
60 | { | ||
61 | |||
62 | httpResponse.StatusCode = (int)HttpStatusCode.Unauthorized; | ||
63 | httpResponse.ContentType = "text/plain"; | ||
64 | return new byte[0]; | ||
65 | } | ||
49 | 66 | ||
50 | byte[] result = ProcessRequest(path, request, httpRequest, httpResponse); | 67 | byte[] result = ProcessRequest(path, request, httpRequest, httpResponse); |
51 | 68 | ||
diff --git a/OpenSim/Framework/ServiceAuth/BasicHttpAuthentication.cs b/OpenSim/Framework/ServiceAuth/BasicHttpAuthentication.cs new file mode 100644 index 0000000..f33a045 --- /dev/null +++ b/OpenSim/Framework/ServiceAuth/BasicHttpAuthentication.cs | |||
@@ -0,0 +1,79 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Collections.Specialized; | ||
4 | using System.Reflection; | ||
5 | |||
6 | using Nini.Config; | ||
7 | using log4net; | ||
8 | |||
9 | namespace OpenSim.Framework.ServiceAuth | ||
10 | { | ||
11 | public class BasicHttpAuthentication : IServiceAuth | ||
12 | { | ||
13 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
14 | |||
15 | private string m_Username, m_Password; | ||
16 | private string m_CredentialsB64; | ||
17 | |||
18 | private string remove_me; | ||
19 | |||
20 | public string Credentials | ||
21 | { | ||
22 | get { return m_CredentialsB64; } | ||
23 | } | ||
24 | |||
25 | public BasicHttpAuthentication(IConfigSource config, string section) | ||
26 | { | ||
27 | remove_me = section; | ||
28 | m_Username = Util.GetConfigVarFromSections<string>(config, "HttpAuthUsername", new string[] { "Network", section }, string.Empty); | ||
29 | m_Password = Util.GetConfigVarFromSections<string>(config, "HttpAuthPassword", new string[] { "Network", section }, string.Empty); | ||
30 | string str = m_Username + ":" + m_Password; | ||
31 | byte[] encData_byte = Util.UTF8.GetBytes(str); | ||
32 | |||
33 | m_CredentialsB64 = Convert.ToBase64String(encData_byte); | ||
34 | m_log.DebugFormat("[HTTP BASIC AUTH]: {0} {1} [{2}]", m_Username, m_Password, section); | ||
35 | } | ||
36 | |||
37 | public void AddAuthorization(NameValueCollection headers) | ||
38 | { | ||
39 | //m_log.DebugFormat("[HTTP BASIC AUTH]: Adding authorization for {0}", remove_me); | ||
40 | headers["Authorization"] = "Basic " + m_CredentialsB64; | ||
41 | } | ||
42 | |||
43 | public bool Authenticate(string data) | ||
44 | { | ||
45 | string recovered = Util.Base64ToString(data); | ||
46 | if (!String.IsNullOrEmpty(recovered)) | ||
47 | { | ||
48 | string[] parts = recovered.Split(new char[] { ':' }); | ||
49 | if (parts.Length >= 2) | ||
50 | { | ||
51 | return m_Username.Equals(parts[0]) && m_Password.Equals(parts[1]); | ||
52 | } | ||
53 | } | ||
54 | |||
55 | return false; | ||
56 | } | ||
57 | |||
58 | public bool Authenticate(NameValueCollection requestHeaders, AddHeaderDelegate d) | ||
59 | { | ||
60 | //m_log.DebugFormat("[HTTP BASIC AUTH]: Authenticate in {0}", remove_me); | ||
61 | if (requestHeaders != null) | ||
62 | { | ||
63 | string value = requestHeaders.Get("Authorization"); | ||
64 | if (value != null) | ||
65 | { | ||
66 | value = value.Trim(); | ||
67 | if (value.StartsWith("Basic ")) | ||
68 | { | ||
69 | value = value.Replace("Basic ", string.Empty); | ||
70 | if (Authenticate(value)) | ||
71 | return true; | ||
72 | } | ||
73 | } | ||
74 | } | ||
75 | d("WWW-Authenticate", "Basic realm = \"Asset Server\""); | ||
76 | return false; | ||
77 | } | ||
78 | } | ||
79 | } | ||
diff --git a/OpenSim/Framework/ServiceAuth/IServiceAuth.cs b/OpenSim/Framework/ServiceAuth/IServiceAuth.cs new file mode 100644 index 0000000..415dc12 --- /dev/null +++ b/OpenSim/Framework/ServiceAuth/IServiceAuth.cs | |||
@@ -0,0 +1,15 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Collections.Specialized; | ||
4 | |||
5 | namespace OpenSim.Framework.ServiceAuth | ||
6 | { | ||
7 | public delegate void AddHeaderDelegate(string key, string value); | ||
8 | |||
9 | public interface IServiceAuth | ||
10 | { | ||
11 | bool Authenticate(string data); | ||
12 | bool Authenticate(NameValueCollection headers, AddHeaderDelegate d); | ||
13 | void AddAuthorization(NameValueCollection headers); | ||
14 | } | ||
15 | } | ||
diff --git a/OpenSim/Framework/ServiceAuth/ServiceAuth.cs b/OpenSim/Framework/ServiceAuth/ServiceAuth.cs new file mode 100644 index 0000000..bc32d90 --- /dev/null +++ b/OpenSim/Framework/ServiceAuth/ServiceAuth.cs | |||
@@ -0,0 +1,23 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | |||
4 | using Nini.Config; | ||
5 | |||
6 | namespace OpenSim.Framework.ServiceAuth | ||
7 | { | ||
8 | public class ServiceAuth | ||
9 | { | ||
10 | public static IServiceAuth Create(IConfigSource config, string section) | ||
11 | { | ||
12 | string authType = Util.GetConfigVarFromSections<string>(config, "AuthType", new string[] { "Network", section }, "None"); | ||
13 | |||
14 | switch (authType) | ||
15 | { | ||
16 | case "BasicHttpAuthentication": | ||
17 | return new BasicHttpAuthentication(config, section); | ||
18 | } | ||
19 | |||
20 | return null; | ||
21 | } | ||
22 | } | ||
23 | } | ||
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 0970fd1..e614fd5 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs | |||
@@ -45,6 +45,8 @@ using Nwc.XmlRpc; | |||
45 | using OpenMetaverse.StructuredData; | 45 | using OpenMetaverse.StructuredData; |
46 | using XMLResponseHelper = OpenSim.Framework.SynchronousRestObjectRequester.XMLResponseHelper; | 46 | using XMLResponseHelper = OpenSim.Framework.SynchronousRestObjectRequester.XMLResponseHelper; |
47 | 47 | ||
48 | using OpenSim.Framework.ServiceAuth; | ||
49 | |||
48 | namespace OpenSim.Framework | 50 | namespace OpenSim.Framework |
49 | { | 51 | { |
50 | /// <summary> | 52 | /// <summary> |
@@ -773,6 +775,13 @@ namespace OpenSim.Framework | |||
773 | string requestUrl, TRequest obj, Action<TResponse> action, | 775 | string requestUrl, TRequest obj, Action<TResponse> action, |
774 | int maxConnections) | 776 | int maxConnections) |
775 | { | 777 | { |
778 | MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, action, maxConnections, null); | ||
779 | } | ||
780 | |||
781 | public static void MakeRequest<TRequest, TResponse>(string verb, | ||
782 | string requestUrl, TRequest obj, Action<TResponse> action, | ||
783 | int maxConnections, IServiceAuth auth) | ||
784 | { | ||
776 | int reqnum = WebUtil.RequestNumber++; | 785 | int reqnum = WebUtil.RequestNumber++; |
777 | 786 | ||
778 | if (WebUtil.DebugLevel >= 3) | 787 | if (WebUtil.DebugLevel >= 3) |
@@ -786,6 +795,10 @@ namespace OpenSim.Framework | |||
786 | 795 | ||
787 | WebRequest request = WebRequest.Create(requestUrl); | 796 | WebRequest request = WebRequest.Create(requestUrl); |
788 | HttpWebRequest ht = (HttpWebRequest)request; | 797 | HttpWebRequest ht = (HttpWebRequest)request; |
798 | |||
799 | if (auth != null) | ||
800 | auth.AddAuthorization(ht.Headers); | ||
801 | |||
789 | if (maxConnections > 0 && ht.ServicePoint.ConnectionLimit < maxConnections) | 802 | if (maxConnections > 0 && ht.ServicePoint.ConnectionLimit < maxConnections) |
790 | ht.ServicePoint.ConnectionLimit = maxConnections; | 803 | ht.ServicePoint.ConnectionLimit = maxConnections; |
791 | 804 | ||
@@ -969,7 +982,7 @@ namespace OpenSim.Framework | |||
969 | /// | 982 | /// |
970 | /// <exception cref="System.Net.WebException">Thrown if we encounter a network issue while posting | 983 | /// <exception cref="System.Net.WebException">Thrown if we encounter a network issue while posting |
971 | /// the request. You'll want to make sure you deal with this as they're not uncommon</exception> | 984 | /// the request. You'll want to make sure you deal with this as they're not uncommon</exception> |
972 | public static string MakeRequest(string verb, string requestUrl, string obj, int timeoutsecs) | 985 | public static string MakeRequest(string verb, string requestUrl, string obj, int timeoutsecs, IServiceAuth auth) |
973 | { | 986 | { |
974 | int reqnum = WebUtil.RequestNumber++; | 987 | int reqnum = WebUtil.RequestNumber++; |
975 | 988 | ||
@@ -984,6 +997,10 @@ namespace OpenSim.Framework | |||
984 | request.Method = verb; | 997 | request.Method = verb; |
985 | if (timeoutsecs > 0) | 998 | if (timeoutsecs > 0) |
986 | request.Timeout = timeoutsecs * 1000; | 999 | request.Timeout = timeoutsecs * 1000; |
1000 | |||
1001 | if (auth != null) | ||
1002 | auth.AddAuthorization(request.Headers); | ||
1003 | |||
987 | string respstring = String.Empty; | 1004 | string respstring = String.Empty; |
988 | 1005 | ||
989 | using (MemoryStream buffer = new MemoryStream()) | 1006 | using (MemoryStream buffer = new MemoryStream()) |
@@ -1068,10 +1085,20 @@ namespace OpenSim.Framework | |||
1068 | return respstring; | 1085 | return respstring; |
1069 | } | 1086 | } |
1070 | 1087 | ||
1088 | public static string MakeRequest(string verb, string requestUrl, string obj, int timeoutsecs) | ||
1089 | { | ||
1090 | return MakeRequest(verb, requestUrl, obj, timeoutsecs, null); | ||
1091 | } | ||
1092 | |||
1071 | public static string MakeRequest(string verb, string requestUrl, string obj) | 1093 | public static string MakeRequest(string verb, string requestUrl, string obj) |
1072 | { | 1094 | { |
1073 | return MakeRequest(verb, requestUrl, obj, -1); | 1095 | return MakeRequest(verb, requestUrl, obj, -1); |
1074 | } | 1096 | } |
1097 | |||
1098 | public static string MakeRequest(string verb, string requestUrl, string obj, IServiceAuth auth) | ||
1099 | { | ||
1100 | return MakeRequest(verb, requestUrl, obj, -1, auth); | ||
1101 | } | ||
1075 | } | 1102 | } |
1076 | 1103 | ||
1077 | public class SynchronousRestObjectRequester | 1104 | public class SynchronousRestObjectRequester |
@@ -1094,6 +1121,10 @@ namespace OpenSim.Framework | |||
1094 | return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, 0); | 1121 | return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, 0); |
1095 | } | 1122 | } |
1096 | 1123 | ||
1124 | public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, IServiceAuth auth) | ||
1125 | { | ||
1126 | return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, 0, auth); | ||
1127 | } | ||
1097 | /// <summary> | 1128 | /// <summary> |
1098 | /// Perform a synchronous REST request. | 1129 | /// Perform a synchronous REST request. |
1099 | /// </summary> | 1130 | /// </summary> |
@@ -1112,7 +1143,11 @@ namespace OpenSim.Framework | |||
1112 | return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, pTimeout, 0); | 1143 | return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, pTimeout, 0); |
1113 | } | 1144 | } |
1114 | 1145 | ||
1115 | /// <summary> | 1146 | public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout, IServiceAuth auth) |
1147 | { | ||
1148 | return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, pTimeout, 0, auth); | ||
1149 | } | ||
1150 | |||
1116 | /// Perform a synchronous REST request. | 1151 | /// Perform a synchronous REST request. |
1117 | /// </summary> | 1152 | /// </summary> |
1118 | /// <param name="verb"></param> | 1153 | /// <param name="verb"></param> |
@@ -1128,6 +1163,25 @@ namespace OpenSim.Framework | |||
1128 | /// </returns> | 1163 | /// </returns> |
1129 | public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout, int maxConnections) | 1164 | public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout, int maxConnections) |
1130 | { | 1165 | { |
1166 | return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, pTimeout, maxConnections, null); | ||
1167 | } | ||
1168 | |||
1169 | /// <summary> | ||
1170 | /// Perform a synchronous REST request. | ||
1171 | /// </summary> | ||
1172 | /// <param name="verb"></param> | ||
1173 | /// <param name="requestUrl"></param> | ||
1174 | /// <param name="obj"></param> | ||
1175 | /// <param name="pTimeout"> | ||
1176 | /// Request timeout in milliseconds. Timeout.Infinite indicates no timeout. If 0 is passed then the default HttpWebRequest timeout is used (100 seconds) | ||
1177 | /// </param> | ||
1178 | /// <param name="maxConnections"></param> | ||
1179 | /// <returns> | ||
1180 | /// The response. If there was an internal exception or the request timed out, | ||
1181 | /// then the default(TResponse) is returned. | ||
1182 | /// </returns> | ||
1183 | public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout, int maxConnections, IServiceAuth auth) | ||
1184 | { | ||
1131 | int reqnum = WebUtil.RequestNumber++; | 1185 | int reqnum = WebUtil.RequestNumber++; |
1132 | 1186 | ||
1133 | if (WebUtil.DebugLevel >= 3) | 1187 | if (WebUtil.DebugLevel >= 3) |
@@ -1143,6 +1197,9 @@ namespace OpenSim.Framework | |||
1143 | WebRequest request = WebRequest.Create(requestUrl); | 1197 | WebRequest request = WebRequest.Create(requestUrl); |
1144 | HttpWebRequest ht = (HttpWebRequest)request; | 1198 | HttpWebRequest ht = (HttpWebRequest)request; |
1145 | 1199 | ||
1200 | if (auth != null) | ||
1201 | auth.AddAuthorization(ht.Headers); | ||
1202 | |||
1146 | if (pTimeout != 0) | 1203 | if (pTimeout != 0) |
1147 | ht.Timeout = pTimeout; | 1204 | ht.Timeout = pTimeout; |
1148 | 1205 | ||
@@ -1221,8 +1278,18 @@ namespace OpenSim.Framework | |||
1221 | { | 1278 | { |
1222 | using (HttpWebResponse hwr = (HttpWebResponse)e.Response) | 1279 | using (HttpWebResponse hwr = (HttpWebResponse)e.Response) |
1223 | { | 1280 | { |
1224 | if (hwr != null && hwr.StatusCode == HttpStatusCode.NotFound) | 1281 | if (hwr != null) |
1225 | return deserial; | 1282 | { |
1283 | if (hwr.StatusCode == HttpStatusCode.NotFound) | ||
1284 | return deserial; | ||
1285 | if (hwr.StatusCode == HttpStatusCode.Unauthorized) | ||
1286 | { | ||
1287 | m_log.Error(string.Format( | ||
1288 | "[SynchronousRestObjectRequester]: Web request {0} requires authentication ", | ||
1289 | requestUrl)); | ||
1290 | return deserial; | ||
1291 | } | ||
1292 | } | ||
1226 | else | 1293 | else |
1227 | m_log.Error(string.Format( | 1294 | m_log.Error(string.Format( |
1228 | "[SynchronousRestObjectRequester]: WebException for {0} {1} {2} ", | 1295 | "[SynchronousRestObjectRequester]: WebException for {0} {1} {2} ", |
diff --git a/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs b/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs index af8a0c1..780d17b 100644 --- a/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs | |||
@@ -37,6 +37,7 @@ using System.Collections.Generic; | |||
37 | using System.Reflection; | 37 | using System.Reflection; |
38 | using log4net; | 38 | using log4net; |
39 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
40 | using OpenSim.Framework.ServiceAuth; | ||
40 | using OpenSim.Framework.Communications; | 41 | using OpenSim.Framework.Communications; |
41 | using OpenSim.Region.Framework.Interfaces; | 42 | using OpenSim.Region.Framework.Interfaces; |
42 | using OpenSim.Region.Framework.Scenes; | 43 | using OpenSim.Region.Framework.Scenes; |
@@ -54,7 +55,7 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures | |||
54 | private string m_URL = String.Empty; | 55 | private string m_URL = String.Empty; |
55 | private static XmlSerializer m_serializer = new XmlSerializer(typeof(AssetBase)); | 56 | private static XmlSerializer m_serializer = new XmlSerializer(typeof(AssetBase)); |
56 | 57 | ||
57 | 58 | private static IServiceAuth m_Auth; | |
58 | 59 | ||
59 | public void Initialise(IConfigSource configSource) | 60 | public void Initialise(IConfigSource configSource) |
60 | { | 61 | { |
@@ -63,6 +64,7 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures | |||
63 | return; | 64 | return; |
64 | 65 | ||
65 | m_URL = config.GetString("URL", String.Empty); | 66 | m_URL = config.GetString("URL", String.Empty); |
67 | m_Auth = ServiceAuth.Create(configSource, "XBakes"); | ||
66 | } | 68 | } |
67 | 69 | ||
68 | public void AddRegion(Scene scene) | 70 | public void AddRegion(Scene scene) |
@@ -110,7 +112,7 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures | |||
110 | 112 | ||
111 | try | 113 | try |
112 | { | 114 | { |
113 | Stream s = rc.Request(); | 115 | Stream s = rc.Request(m_Auth); |
114 | XmlTextReader sr = new XmlTextReader(s); | 116 | XmlTextReader sr = new XmlTextReader(s); |
115 | 117 | ||
116 | sr.ReadStartElement("BakedAppearance"); | 118 | sr.ReadStartElement("BakedAppearance"); |
@@ -183,7 +185,7 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures | |||
183 | Util.FireAndForget( | 185 | Util.FireAndForget( |
184 | delegate | 186 | delegate |
185 | { | 187 | { |
186 | rc.Request(reqStream); | 188 | rc.Request(reqStream, m_Auth); |
187 | } | 189 | } |
188 | ); | 190 | ); |
189 | } | 191 | } |
diff --git a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs index 0c0a7aa..4a06f6e 100644 --- a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs +++ b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs | |||
@@ -381,7 +381,7 @@ namespace OpenSim.Region.DataSnapshot | |||
381 | cli.RequestMethod = "GET"; | 381 | cli.RequestMethod = "GET"; |
382 | try | 382 | try |
383 | { | 383 | { |
384 | reply = cli.Request(); | 384 | reply = cli.Request(null); |
385 | } | 385 | } |
386 | catch (WebException) | 386 | catch (WebException) |
387 | { | 387 | { |
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs index 9b86986..df9a51b 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs | |||
@@ -30,6 +30,7 @@ using System.IO; | |||
30 | using Nini.Config; | 30 | using Nini.Config; |
31 | using OpenMetaverse; | 31 | using OpenMetaverse; |
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Framework.ServiceAuth; | ||
33 | using OpenSim.Framework.Console; | 34 | using OpenSim.Framework.Console; |
34 | using OpenSim.Server.Base; | 35 | using OpenSim.Server.Base; |
35 | using OpenSim.Services.Interfaces; | 36 | using OpenSim.Services.Interfaces; |
@@ -83,9 +84,11 @@ namespace OpenSim.Server.Handlers.Asset | |||
83 | allowedRemoteDeleteTypes = AllowedRemoteDeleteTypes.MapTile; | 84 | allowedRemoteDeleteTypes = AllowedRemoteDeleteTypes.MapTile; |
84 | } | 85 | } |
85 | 86 | ||
86 | server.AddStreamHandler(new AssetServerGetHandler(m_AssetService)); | 87 | IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); |
87 | server.AddStreamHandler(new AssetServerPostHandler(m_AssetService)); | 88 | |
88 | server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService, allowedRemoteDeleteTypes)); | 89 | server.AddStreamHandler(new AssetServerGetHandler(m_AssetService, auth)); |
90 | server.AddStreamHandler(new AssetServerPostHandler(m_AssetService, auth)); | ||
91 | server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService, allowedRemoteDeleteTypes, auth)); | ||
89 | server.AddStreamHandler(new AssetsExistHandler(m_AssetService)); | 92 | server.AddStreamHandler(new AssetsExistHandler(m_AssetService)); |
90 | 93 | ||
91 | MainConsole.Instance.Commands.AddCommand("Assets", false, | 94 | MainConsole.Instance.Commands.AddCommand("Assets", false, |
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs index 941b97d..d85d471 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs | |||
@@ -38,6 +38,7 @@ using System.Xml.Serialization; | |||
38 | using OpenSim.Server.Base; | 38 | using OpenSim.Server.Base; |
39 | using OpenSim.Services.Interfaces; | 39 | using OpenSim.Services.Interfaces; |
40 | using OpenSim.Framework; | 40 | using OpenSim.Framework; |
41 | using OpenSim.Framework.ServiceAuth; | ||
41 | using OpenSim.Framework.Servers.HttpServer; | 42 | using OpenSim.Framework.Servers.HttpServer; |
42 | 43 | ||
43 | namespace OpenSim.Server.Handlers.Asset | 44 | namespace OpenSim.Server.Handlers.Asset |
@@ -70,6 +71,12 @@ namespace OpenSim.Server.Handlers.Asset | |||
70 | m_allowedTypes = allowedTypes; | 71 | m_allowedTypes = allowedTypes; |
71 | } | 72 | } |
72 | 73 | ||
74 | public AssetServerDeleteHandler(IAssetService service, AllowedRemoteDeleteTypes allowedTypes, IServiceAuth auth) : | ||
75 | base("DELETE", "/assets", auth) | ||
76 | { | ||
77 | m_AssetService = service; | ||
78 | m_allowedTypes = allowedTypes; | ||
79 | } | ||
73 | protected override byte[] ProcessRequest(string path, Stream request, | 80 | protected override byte[] ProcessRequest(string path, Stream request, |
74 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 81 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
75 | { | 82 | { |
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs index ed3b4af..500ec50 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs | |||
@@ -38,19 +38,26 @@ using System.Xml.Serialization; | |||
38 | using OpenSim.Server.Base; | 38 | using OpenSim.Server.Base; |
39 | using OpenSim.Services.Interfaces; | 39 | using OpenSim.Services.Interfaces; |
40 | using OpenSim.Framework; | 40 | using OpenSim.Framework; |
41 | using OpenSim.Framework.ServiceAuth; | ||
41 | using OpenSim.Framework.Servers.HttpServer; | 42 | using OpenSim.Framework.Servers.HttpServer; |
42 | 43 | ||
43 | namespace OpenSim.Server.Handlers.Asset | 44 | namespace OpenSim.Server.Handlers.Asset |
44 | { | 45 | { |
45 | public class AssetServerGetHandler : BaseStreamHandler | 46 | public class AssetServerGetHandler : BaseStreamHandler |
46 | { | 47 | { |
47 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 49 | ||
49 | private IAssetService m_AssetService; | 50 | private IAssetService m_AssetService; |
50 | 51 | ||
51 | public AssetServerGetHandler(IAssetService service) : | 52 | public AssetServerGetHandler(IAssetService service) : |
52 | base("GET", "/assets") | 53 | base("GET", "/assets") |
53 | { | 54 | { |
55 | m_AssetService = service; | ||
56 | } | ||
57 | |||
58 | public AssetServerGetHandler(IAssetService service, IServiceAuth auth) : | ||
59 | base("GET", "/assets", auth) | ||
60 | { | ||
54 | m_AssetService = service; | 61 | m_AssetService = service; |
55 | } | 62 | } |
56 | 63 | ||
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs index a77e67d..1c706a7 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs | |||
@@ -38,6 +38,7 @@ using System.Xml.Serialization; | |||
38 | using OpenSim.Server.Base; | 38 | using OpenSim.Server.Base; |
39 | using OpenSim.Services.Interfaces; | 39 | using OpenSim.Services.Interfaces; |
40 | using OpenSim.Framework; | 40 | using OpenSim.Framework; |
41 | using OpenSim.Framework.ServiceAuth; | ||
41 | using OpenSim.Framework.Servers.HttpServer; | 42 | using OpenSim.Framework.Servers.HttpServer; |
42 | 43 | ||
43 | namespace OpenSim.Server.Handlers.Asset | 44 | namespace OpenSim.Server.Handlers.Asset |
@@ -54,6 +55,12 @@ namespace OpenSim.Server.Handlers.Asset | |||
54 | m_AssetService = service; | 55 | m_AssetService = service; |
55 | } | 56 | } |
56 | 57 | ||
58 | public AssetServerPostHandler(IAssetService service, IServiceAuth auth) : | ||
59 | base("POST", "/assets", auth) | ||
60 | { | ||
61 | m_AssetService = service; | ||
62 | } | ||
63 | |||
57 | protected override byte[] ProcessRequest(string path, Stream request, | 64 | protected override byte[] ProcessRequest(string path, Stream request, |
58 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 65 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
59 | { | 66 | { |
diff --git a/OpenSim/Server/Handlers/Asset/AssetsExistHandler.cs b/OpenSim/Server/Handlers/Asset/AssetsExistHandler.cs index 6d01f86..32901b3 100644 --- a/OpenSim/Server/Handlers/Asset/AssetsExistHandler.cs +++ b/OpenSim/Server/Handlers/Asset/AssetsExistHandler.cs | |||
@@ -38,6 +38,7 @@ using System.Xml.Serialization; | |||
38 | using OpenSim.Server.Base; | 38 | using OpenSim.Server.Base; |
39 | using OpenSim.Services.Interfaces; | 39 | using OpenSim.Services.Interfaces; |
40 | using OpenSim.Framework; | 40 | using OpenSim.Framework; |
41 | using OpenSim.Framework.ServiceAuth; | ||
41 | using OpenSim.Framework.Servers.HttpServer; | 42 | using OpenSim.Framework.Servers.HttpServer; |
42 | using OpenMetaverse; | 43 | using OpenMetaverse; |
43 | 44 | ||
@@ -55,6 +56,12 @@ namespace OpenSim.Server.Handlers.Asset | |||
55 | m_AssetService = service; | 56 | m_AssetService = service; |
56 | } | 57 | } |
57 | 58 | ||
59 | public AssetsExistHandler(IAssetService service, IServiceAuth auth) : | ||
60 | base("POST", "/get_assets_exist", auth) | ||
61 | { | ||
62 | m_AssetService = service; | ||
63 | } | ||
64 | |||
58 | protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 65 | protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
59 | { | 66 | { |
60 | XmlSerializer xs; | 67 | XmlSerializer xs; |
diff --git a/OpenSim/Server/Handlers/Authentication/AuthenticationServerConnector.cs b/OpenSim/Server/Handlers/Authentication/AuthenticationServerConnector.cs index 848a037..c9a8dce 100644 --- a/OpenSim/Server/Handlers/Authentication/AuthenticationServerConnector.cs +++ b/OpenSim/Server/Handlers/Authentication/AuthenticationServerConnector.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using Nini.Config; | 29 | using Nini.Config; |
30 | using OpenSim.Server.Base; | 30 | using OpenSim.Server.Base; |
31 | using OpenSim.Services.Interfaces; | 31 | using OpenSim.Services.Interfaces; |
32 | using OpenSim.Framework.ServiceAuth; | ||
32 | using OpenSim.Framework.Servers.HttpServer; | 33 | using OpenSim.Framework.Servers.HttpServer; |
33 | using OpenSim.Server.Handlers.Base; | 34 | using OpenSim.Server.Handlers.Base; |
34 | 35 | ||
@@ -58,7 +59,9 @@ namespace OpenSim.Server.Handlers.Authentication | |||
58 | Object[] args = new Object[] { config }; | 59 | Object[] args = new Object[] { config }; |
59 | m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authenticationService, args); | 60 | m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authenticationService, args); |
60 | 61 | ||
61 | server.AddStreamHandler(new AuthenticationServerPostHandler(m_AuthenticationService, serverConfig)); | 62 | IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); |
63 | |||
64 | server.AddStreamHandler(new AuthenticationServerPostHandler(m_AuthenticationService, serverConfig, auth)); | ||
62 | } | 65 | } |
63 | } | 66 | } |
64 | } | 67 | } |
diff --git a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs index 16e011a..e258dde 100644 --- a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs | |||
@@ -39,6 +39,7 @@ using System.Collections.Generic; | |||
39 | using OpenSim.Server.Base; | 39 | using OpenSim.Server.Base; |
40 | using OpenSim.Services.Interfaces; | 40 | using OpenSim.Services.Interfaces; |
41 | using OpenSim.Framework; | 41 | using OpenSim.Framework; |
42 | using OpenSim.Framework.ServiceAuth; | ||
42 | using OpenSim.Framework.Servers.HttpServer; | 43 | using OpenSim.Framework.Servers.HttpServer; |
43 | using OpenMetaverse; | 44 | using OpenMetaverse; |
44 | 45 | ||
@@ -55,10 +56,10 @@ namespace OpenSim.Server.Handlers.Authentication | |||
55 | private bool m_AllowSetPassword = false; | 56 | private bool m_AllowSetPassword = false; |
56 | 57 | ||
57 | public AuthenticationServerPostHandler(IAuthenticationService service) : | 58 | public AuthenticationServerPostHandler(IAuthenticationService service) : |
58 | this(service, null) {} | 59 | this(service, null, null) {} |
59 | 60 | ||
60 | public AuthenticationServerPostHandler(IAuthenticationService service, IConfig config) : | 61 | public AuthenticationServerPostHandler(IAuthenticationService service, IConfig config, IServiceAuth auth) : |
61 | base("POST", "/auth") | 62 | base("POST", "/auth", auth) |
62 | { | 63 | { |
63 | m_AuthenticationService = service; | 64 | m_AuthenticationService = service; |
64 | 65 | ||
@@ -73,6 +74,7 @@ namespace OpenSim.Server.Handlers.Authentication | |||
73 | protected override byte[] ProcessRequest(string path, Stream request, | 74 | protected override byte[] ProcessRequest(string path, Stream request, |
74 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 75 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
75 | { | 76 | { |
77 | m_log.Error("[XXX]: Authenticating..."); | ||
76 | string[] p = SplitParams(path); | 78 | string[] p = SplitParams(path); |
77 | 79 | ||
78 | if (p.Length > 0) | 80 | if (p.Length > 0) |
diff --git a/OpenSim/Server/Handlers/Avatar/AvatarServerConnector.cs b/OpenSim/Server/Handlers/Avatar/AvatarServerConnector.cs index 9a57cd9..1831e84 100644 --- a/OpenSim/Server/Handlers/Avatar/AvatarServerConnector.cs +++ b/OpenSim/Server/Handlers/Avatar/AvatarServerConnector.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using Nini.Config; | 29 | using Nini.Config; |
30 | using OpenSim.Server.Base; | 30 | using OpenSim.Server.Base; |
31 | using OpenSim.Services.Interfaces; | 31 | using OpenSim.Services.Interfaces; |
32 | using OpenSim.Framework.ServiceAuth; | ||
32 | using OpenSim.Framework.Servers.HttpServer; | 33 | using OpenSim.Framework.Servers.HttpServer; |
33 | using OpenSim.Server.Handlers.Base; | 34 | using OpenSim.Server.Handlers.Base; |
34 | 35 | ||
@@ -55,7 +56,9 @@ namespace OpenSim.Server.Handlers.Avatar | |||
55 | Object[] args = new Object[] { config }; | 56 | Object[] args = new Object[] { config }; |
56 | m_AvatarService = ServerUtils.LoadPlugin<IAvatarService>(avatarService, args); | 57 | m_AvatarService = ServerUtils.LoadPlugin<IAvatarService>(avatarService, args); |
57 | 58 | ||
58 | server.AddStreamHandler(new AvatarServerPostHandler(m_AvatarService)); | 59 | IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); |
60 | |||
61 | server.AddStreamHandler(new AvatarServerPostHandler(m_AvatarService, auth)); | ||
59 | } | 62 | } |
60 | } | 63 | } |
61 | } | 64 | } |
diff --git a/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs b/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs index d6bbb8f..59dbed4 100644 --- a/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs | |||
@@ -39,6 +39,7 @@ using System.Collections.Generic; | |||
39 | using OpenSim.Server.Base; | 39 | using OpenSim.Server.Base; |
40 | using OpenSim.Services.Interfaces; | 40 | using OpenSim.Services.Interfaces; |
41 | using OpenSim.Framework; | 41 | using OpenSim.Framework; |
42 | using OpenSim.Framework.ServiceAuth; | ||
42 | using OpenSim.Framework.Servers.HttpServer; | 43 | using OpenSim.Framework.Servers.HttpServer; |
43 | using OpenMetaverse; | 44 | using OpenMetaverse; |
44 | 45 | ||
@@ -50,8 +51,8 @@ namespace OpenSim.Server.Handlers.Avatar | |||
50 | 51 | ||
51 | private IAvatarService m_AvatarService; | 52 | private IAvatarService m_AvatarService; |
52 | 53 | ||
53 | public AvatarServerPostHandler(IAvatarService service) : | 54 | public AvatarServerPostHandler(IAvatarService service, IServiceAuth auth) : |
54 | base("POST", "/avatar") | 55 | base("POST", "/avatar", auth) |
55 | { | 56 | { |
56 | m_AvatarService = service; | 57 | m_AvatarService = service; |
57 | } | 58 | } |
diff --git a/OpenSim/Server/Handlers/BakedTextures/XBakesGetHandler.cs b/OpenSim/Server/Handlers/BakedTextures/XBakesGetHandler.cs index fb4b794..9e703f1 100644 --- a/OpenSim/Server/Handlers/BakedTextures/XBakesGetHandler.cs +++ b/OpenSim/Server/Handlers/BakedTextures/XBakesGetHandler.cs | |||
@@ -38,6 +38,7 @@ using System.Xml.Serialization; | |||
38 | using OpenSim.Server.Base; | 38 | using OpenSim.Server.Base; |
39 | using OpenSim.Services.Interfaces; | 39 | using OpenSim.Services.Interfaces; |
40 | using OpenSim.Framework; | 40 | using OpenSim.Framework; |
41 | using OpenSim.Framework.ServiceAuth; | ||
41 | using OpenSim.Framework.Servers.HttpServer; | 42 | using OpenSim.Framework.Servers.HttpServer; |
42 | 43 | ||
43 | namespace OpenSim.Server.Handlers.BakedTextures | 44 | namespace OpenSim.Server.Handlers.BakedTextures |
@@ -50,14 +51,14 @@ namespace OpenSim.Server.Handlers.BakedTextures | |||
50 | private System.Text.UTF8Encoding utf8 = | 51 | private System.Text.UTF8Encoding utf8 = |
51 | new System.Text.UTF8Encoding(); | 52 | new System.Text.UTF8Encoding(); |
52 | 53 | ||
53 | public BakesServerGetHandler(IBakedTextureService service) : | 54 | public BakesServerGetHandler(IBakedTextureService service, IServiceAuth auth) : |
54 | base("GET", "/bakes") | 55 | base("GET", "/bakes", auth) |
55 | { | 56 | { |
56 | m_BakesService = service; | 57 | m_BakesService = service; |
57 | } | 58 | } |
58 | 59 | ||
59 | public override byte[] Handle(string path, Stream request, | 60 | protected override byte[] ProcessRequest( |
60 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 61 | string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
61 | { | 62 | { |
62 | string[] p = SplitParams(path); | 63 | string[] p = SplitParams(path); |
63 | 64 | ||
diff --git a/OpenSim/Server/Handlers/BakedTextures/XBakesHandler.cs b/OpenSim/Server/Handlers/BakedTextures/XBakesHandler.cs index 7bf7641..4c12967 100644 --- a/OpenSim/Server/Handlers/BakedTextures/XBakesHandler.cs +++ b/OpenSim/Server/Handlers/BakedTextures/XBakesHandler.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using Nini.Config; | 29 | using Nini.Config; |
30 | using OpenSim.Server.Base; | 30 | using OpenSim.Server.Base; |
31 | using OpenSim.Services.Interfaces; | 31 | using OpenSim.Services.Interfaces; |
32 | using OpenSim.Framework.ServiceAuth; | ||
32 | using OpenSim.Framework.Servers.HttpServer; | 33 | using OpenSim.Framework.Servers.HttpServer; |
33 | using OpenSim.Server.Handlers.Base; | 34 | using OpenSim.Server.Handlers.Base; |
34 | 35 | ||
@@ -59,8 +60,10 @@ namespace OpenSim.Server.Handlers.BakedTextures | |||
59 | m_BakesService = | 60 | m_BakesService = |
60 | ServerUtils.LoadPlugin<IBakedTextureService>(assetService, args); | 61 | ServerUtils.LoadPlugin<IBakedTextureService>(assetService, args); |
61 | 62 | ||
62 | server.AddStreamHandler(new BakesServerGetHandler(m_BakesService)); | 63 | IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); |
63 | server.AddStreamHandler(new BakesServerPostHandler(m_BakesService)); | 64 | |
65 | server.AddStreamHandler(new BakesServerGetHandler(m_BakesService, auth)); | ||
66 | server.AddStreamHandler(new BakesServerPostHandler(m_BakesService, auth)); | ||
64 | } | 67 | } |
65 | } | 68 | } |
66 | } | 69 | } |
diff --git a/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs b/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs index 69adb7f..1aacbc9 100644 --- a/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs +++ b/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs | |||
@@ -38,27 +38,28 @@ using System.Xml.Serialization; | |||
38 | using OpenSim.Server.Base; | 38 | using OpenSim.Server.Base; |
39 | using OpenSim.Services.Interfaces; | 39 | using OpenSim.Services.Interfaces; |
40 | using OpenSim.Framework; | 40 | using OpenSim.Framework; |
41 | using OpenSim.Framework.ServiceAuth; | ||
41 | using OpenSim.Framework.Servers.HttpServer; | 42 | using OpenSim.Framework.Servers.HttpServer; |
42 | 43 | ||
43 | namespace OpenSim.Server.Handlers.BakedTextures | 44 | namespace OpenSim.Server.Handlers.BakedTextures |
44 | { | 45 | { |
45 | public class BakesServerPostHandler : BaseStreamHandler | 46 | public class BakesServerPostHandler : BaseStreamHandler |
46 | { | 47 | { |
47 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 49 | ||
49 | private IBakedTextureService m_BakesService; | 50 | private IBakedTextureService m_BakesService; |
50 | 51 | ||
51 | private System.Text.UTF8Encoding utf8 = | 52 | private System.Text.UTF8Encoding utf8 = |
52 | new System.Text.UTF8Encoding(); | 53 | new System.Text.UTF8Encoding(); |
53 | 54 | ||
54 | public BakesServerPostHandler(IBakedTextureService service) : | 55 | public BakesServerPostHandler(IBakedTextureService service, IServiceAuth auth) : |
55 | base("POST", "/bakes") | 56 | base("POST", "/bakes", auth) |
56 | { | 57 | { |
57 | m_BakesService = service; | 58 | m_BakesService = service; |
58 | } | 59 | } |
59 | 60 | ||
60 | public override byte[] Handle(string path, Stream request, | 61 | protected override byte[] ProcessRequest( |
61 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 62 | string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
62 | { | 63 | { |
63 | string[] p = SplitParams(path); | 64 | string[] p = SplitParams(path); |
64 | 65 | ||
diff --git a/OpenSim/Server/Handlers/Friends/FriendServerConnector.cs b/OpenSim/Server/Handlers/Friends/FriendServerConnector.cs index 5784bdf..b0e6c7d 100644 --- a/OpenSim/Server/Handlers/Friends/FriendServerConnector.cs +++ b/OpenSim/Server/Handlers/Friends/FriendServerConnector.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using Nini.Config; | 29 | using Nini.Config; |
30 | using OpenSim.Server.Base; | 30 | using OpenSim.Server.Base; |
31 | using OpenSim.Services.Interfaces; | 31 | using OpenSim.Services.Interfaces; |
32 | using OpenSim.Framework.ServiceAuth; | ||
32 | using OpenSim.Framework.Servers.HttpServer; | 33 | using OpenSim.Framework.Servers.HttpServer; |
33 | using OpenSim.Server.Handlers.Base; | 34 | using OpenSim.Server.Handlers.Base; |
34 | 35 | ||
@@ -55,7 +56,8 @@ namespace OpenSim.Server.Handlers.Friends | |||
55 | Object[] args = new Object[] { config }; | 56 | Object[] args = new Object[] { config }; |
56 | m_FriendsService = ServerUtils.LoadPlugin<IFriendsService>(theService, args); | 57 | m_FriendsService = ServerUtils.LoadPlugin<IFriendsService>(theService, args); |
57 | 58 | ||
58 | server.AddStreamHandler(new FriendsServerPostHandler(m_FriendsService)); | 59 | IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); |
60 | server.AddStreamHandler(new FriendsServerPostHandler(m_FriendsService, auth)); | ||
59 | } | 61 | } |
60 | } | 62 | } |
61 | } | 63 | } |
diff --git a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs index ca0a24c..d442443 100644 --- a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs | |||
@@ -40,6 +40,7 @@ using OpenSim.Server.Base; | |||
40 | using OpenSim.Services.Interfaces; | 40 | using OpenSim.Services.Interfaces; |
41 | using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; | 41 | using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; |
42 | using OpenSim.Framework; | 42 | using OpenSim.Framework; |
43 | using OpenSim.Framework.ServiceAuth; | ||
43 | using OpenSim.Framework.Servers.HttpServer; | 44 | using OpenSim.Framework.Servers.HttpServer; |
44 | using OpenMetaverse; | 45 | using OpenMetaverse; |
45 | 46 | ||
@@ -51,8 +52,8 @@ namespace OpenSim.Server.Handlers.Friends | |||
51 | 52 | ||
52 | private IFriendsService m_FriendsService; | 53 | private IFriendsService m_FriendsService; |
53 | 54 | ||
54 | public FriendsServerPostHandler(IFriendsService service) : | 55 | public FriendsServerPostHandler(IFriendsService service, IServiceAuth auth) : |
55 | base("POST", "/friends") | 56 | base("POST", "/friends", auth) |
56 | { | 57 | { |
57 | m_FriendsService = service; | 58 | m_FriendsService = service; |
58 | } | 59 | } |
diff --git a/OpenSim/Server/Handlers/Grid/GridServerConnector.cs b/OpenSim/Server/Handlers/Grid/GridServerConnector.cs index 14daf12..6eb6a79 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerConnector.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerConnector.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using Nini.Config; | 29 | using Nini.Config; |
30 | using OpenSim.Server.Base; | 30 | using OpenSim.Server.Base; |
31 | using OpenSim.Services.Interfaces; | 31 | using OpenSim.Services.Interfaces; |
32 | using OpenSim.Framework.ServiceAuth; | ||
32 | using OpenSim.Framework.Servers.HttpServer; | 33 | using OpenSim.Framework.Servers.HttpServer; |
33 | using OpenSim.Server.Handlers.Base; | 34 | using OpenSim.Server.Handlers.Base; |
34 | 35 | ||
@@ -55,7 +56,9 @@ namespace OpenSim.Server.Handlers.Grid | |||
55 | Object[] args = new Object[] { config }; | 56 | Object[] args = new Object[] { config }; |
56 | m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args); | 57 | m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args); |
57 | 58 | ||
58 | server.AddStreamHandler(new GridServerPostHandler(m_GridService)); | 59 | IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); |
60 | |||
61 | server.AddStreamHandler(new GridServerPostHandler(m_GridService, auth)); | ||
59 | } | 62 | } |
60 | } | 63 | } |
61 | } | 64 | } |
diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index 37ca5a4..dda4756 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs | |||
@@ -40,6 +40,7 @@ using OpenSim.Server.Base; | |||
40 | using OpenSim.Services.Interfaces; | 40 | using OpenSim.Services.Interfaces; |
41 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 41 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
42 | using OpenSim.Framework; | 42 | using OpenSim.Framework; |
43 | using OpenSim.Framework.ServiceAuth; | ||
43 | using OpenSim.Framework.Servers.HttpServer; | 44 | using OpenSim.Framework.Servers.HttpServer; |
44 | using OpenMetaverse; | 45 | using OpenMetaverse; |
45 | 46 | ||
@@ -55,8 +56,8 @@ namespace OpenSim.Server.Handlers.Grid | |||
55 | 56 | ||
56 | private IGridService m_GridService; | 57 | private IGridService m_GridService; |
57 | 58 | ||
58 | public GridServerPostHandler(IGridService service) : | 59 | public GridServerPostHandler(IGridService service, IServiceAuth auth) : |
59 | base("POST", "/grid") | 60 | base("POST", "/grid", auth) |
60 | { | 61 | { |
61 | m_GridService = service; | 62 | m_GridService = service; |
62 | } | 63 | } |
diff --git a/OpenSim/Server/Handlers/GridUser/GridUserServerConnector.cs b/OpenSim/Server/Handlers/GridUser/GridUserServerConnector.cs index 66f35e3..1e29378 100644 --- a/OpenSim/Server/Handlers/GridUser/GridUserServerConnector.cs +++ b/OpenSim/Server/Handlers/GridUser/GridUserServerConnector.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using Nini.Config; | 29 | using Nini.Config; |
30 | using OpenSim.Server.Base; | 30 | using OpenSim.Server.Base; |
31 | using OpenSim.Services.Interfaces; | 31 | using OpenSim.Services.Interfaces; |
32 | using OpenSim.Framework.ServiceAuth; | ||
32 | using OpenSim.Framework.Servers.HttpServer; | 33 | using OpenSim.Framework.Servers.HttpServer; |
33 | using OpenSim.Server.Handlers.Base; | 34 | using OpenSim.Server.Handlers.Base; |
34 | 35 | ||
@@ -55,7 +56,9 @@ namespace OpenSim.Server.Handlers.GridUser | |||
55 | Object[] args = new Object[] { config }; | 56 | Object[] args = new Object[] { config }; |
56 | m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(service, args); | 57 | m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(service, args); |
57 | 58 | ||
58 | server.AddStreamHandler(new GridUserServerPostHandler(m_GridUserService)); | 59 | IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); ; |
60 | |||
61 | server.AddStreamHandler(new GridUserServerPostHandler(m_GridUserService, auth)); | ||
59 | } | 62 | } |
60 | } | 63 | } |
61 | } | 64 | } |
diff --git a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs index 0b98e9a..006f6ab 100644 --- a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs +++ b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs | |||
@@ -39,6 +39,7 @@ using System.Collections.Generic; | |||
39 | using OpenSim.Server.Base; | 39 | using OpenSim.Server.Base; |
40 | using OpenSim.Services.Interfaces; | 40 | using OpenSim.Services.Interfaces; |
41 | using OpenSim.Framework; | 41 | using OpenSim.Framework; |
42 | using OpenSim.Framework.ServiceAuth; | ||
42 | using OpenSim.Framework.Servers.HttpServer; | 43 | using OpenSim.Framework.Servers.HttpServer; |
43 | using OpenMetaverse; | 44 | using OpenMetaverse; |
44 | 45 | ||
@@ -50,8 +51,8 @@ namespace OpenSim.Server.Handlers.GridUser | |||
50 | 51 | ||
51 | private IGridUserService m_GridUserService; | 52 | private IGridUserService m_GridUserService; |
52 | 53 | ||
53 | public GridUserServerPostHandler(IGridUserService service) : | 54 | public GridUserServerPostHandler(IGridUserService service, IServiceAuth auth) : |
54 | base("POST", "/griduser") | 55 | base("POST", "/griduser", auth) |
55 | { | 56 | { |
56 | m_GridUserService = service; | 57 | m_GridUserService = service; |
57 | } | 58 | } |
diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index ce975a8..7283237 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs | |||
@@ -33,6 +33,7 @@ using System.Collections.Generic; | |||
33 | using System.IO; | 33 | using System.IO; |
34 | using Nini.Config; | 34 | using Nini.Config; |
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Framework.ServiceAuth; | ||
36 | using OpenSim.Server.Base; | 37 | using OpenSim.Server.Base; |
37 | using OpenSim.Services.Interfaces; | 38 | using OpenSim.Services.Interfaces; |
38 | using OpenSim.Framework.Servers.HttpServer; | 39 | using OpenSim.Framework.Servers.HttpServer; |
@@ -71,7 +72,9 @@ namespace OpenSim.Server.Handlers.Asset | |||
71 | m_InventoryService = | 72 | m_InventoryService = |
72 | ServerUtils.LoadPlugin<IInventoryService>(inventoryService, args); | 73 | ServerUtils.LoadPlugin<IInventoryService>(inventoryService, args); |
73 | 74 | ||
74 | server.AddStreamHandler(new XInventoryConnectorPostHandler(m_InventoryService)); | 75 | IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); |
76 | |||
77 | server.AddStreamHandler(new XInventoryConnectorPostHandler(m_InventoryService, auth)); | ||
75 | } | 78 | } |
76 | } | 79 | } |
77 | 80 | ||
@@ -81,8 +84,8 @@ namespace OpenSim.Server.Handlers.Asset | |||
81 | 84 | ||
82 | private IInventoryService m_InventoryService; | 85 | private IInventoryService m_InventoryService; |
83 | 86 | ||
84 | public XInventoryConnectorPostHandler(IInventoryService service) : | 87 | public XInventoryConnectorPostHandler(IInventoryService service, IServiceAuth auth) : |
85 | base("POST", "/xinventory") | 88 | base("POST", "/xinventory", auth) |
86 | { | 89 | { |
87 | m_InventoryService = service; | 90 | m_InventoryService = service; |
88 | } | 91 | } |
diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs index 4d1729e..a896fdb 100644 --- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs | |||
@@ -38,6 +38,7 @@ using OpenMetaverse; | |||
38 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
39 | using OpenSim.Server.Base; | 39 | using OpenSim.Server.Base; |
40 | using OpenSim.Services.Interfaces; | 40 | using OpenSim.Services.Interfaces; |
41 | using OpenSim.Framework.ServiceAuth; | ||
41 | using OpenSim.Framework.Servers.HttpServer; | 42 | using OpenSim.Framework.Servers.HttpServer; |
42 | using OpenSim.Server.Handlers.Base; | 43 | using OpenSim.Server.Handlers.Base; |
43 | 44 | ||
@@ -79,7 +80,8 @@ namespace OpenSim.Server.Handlers.MapImage | |||
79 | m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is OFF"); | 80 | m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is OFF"); |
80 | 81 | ||
81 | bool proxy = serverConfig.GetBoolean("HasProxy", false); | 82 | bool proxy = serverConfig.GetBoolean("HasProxy", false); |
82 | server.AddStreamHandler(new MapServerPostHandler(m_MapService, m_GridService, proxy)); | 83 | IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); |
84 | server.AddStreamHandler(new MapServerPostHandler(m_MapService, m_GridService, proxy, auth)); | ||
83 | 85 | ||
84 | } | 86 | } |
85 | } | 87 | } |
@@ -91,8 +93,8 @@ namespace OpenSim.Server.Handlers.MapImage | |||
91 | private IGridService m_GridService; | 93 | private IGridService m_GridService; |
92 | bool m_Proxy; | 94 | bool m_Proxy; |
93 | 95 | ||
94 | public MapServerPostHandler(IMapImageService service, IGridService grid, bool proxy) : | 96 | public MapServerPostHandler(IMapImageService service, IGridService grid, bool proxy, IServiceAuth auth) : |
95 | base("POST", "/map") | 97 | base("POST", "/map", auth) |
96 | { | 98 | { |
97 | m_MapService = service; | 99 | m_MapService = service; |
98 | m_GridService = grid; | 100 | m_GridService = grid; |
diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerConnector.cs b/OpenSim/Server/Handlers/Presence/PresenceServerConnector.cs index 899cd8f..7a63c36 100644 --- a/OpenSim/Server/Handlers/Presence/PresenceServerConnector.cs +++ b/OpenSim/Server/Handlers/Presence/PresenceServerConnector.cs | |||
@@ -30,6 +30,7 @@ using Nini.Config; | |||
30 | using OpenSim.Server.Base; | 30 | using OpenSim.Server.Base; |
31 | using OpenSim.Services.Interfaces; | 31 | using OpenSim.Services.Interfaces; |
32 | using OpenSim.Framework.Servers.HttpServer; | 32 | using OpenSim.Framework.Servers.HttpServer; |
33 | using OpenSim.Framework.ServiceAuth; | ||
33 | using OpenSim.Server.Handlers.Base; | 34 | using OpenSim.Server.Handlers.Base; |
34 | 35 | ||
35 | namespace OpenSim.Server.Handlers.Presence | 36 | namespace OpenSim.Server.Handlers.Presence |
@@ -55,7 +56,9 @@ namespace OpenSim.Server.Handlers.Presence | |||
55 | Object[] args = new Object[] { config }; | 56 | Object[] args = new Object[] { config }; |
56 | m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(gridService, args); | 57 | m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(gridService, args); |
57 | 58 | ||
58 | server.AddStreamHandler(new PresenceServerPostHandler(m_PresenceService)); | 59 | IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); |
60 | |||
61 | server.AddStreamHandler(new PresenceServerPostHandler(m_PresenceService, auth)); | ||
59 | } | 62 | } |
60 | } | 63 | } |
61 | } | 64 | } |
diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs index abb4b19..0b3b961 100644 --- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs | |||
@@ -40,6 +40,7 @@ using OpenSim.Server.Base; | |||
40 | using OpenSim.Services.Interfaces; | 40 | using OpenSim.Services.Interfaces; |
41 | using OpenSim.Framework; | 41 | using OpenSim.Framework; |
42 | using OpenSim.Framework.Servers.HttpServer; | 42 | using OpenSim.Framework.Servers.HttpServer; |
43 | using OpenSim.Framework.ServiceAuth; | ||
43 | using OpenMetaverse; | 44 | using OpenMetaverse; |
44 | 45 | ||
45 | namespace OpenSim.Server.Handlers.Presence | 46 | namespace OpenSim.Server.Handlers.Presence |
@@ -50,8 +51,8 @@ namespace OpenSim.Server.Handlers.Presence | |||
50 | 51 | ||
51 | private IPresenceService m_PresenceService; | 52 | private IPresenceService m_PresenceService; |
52 | 53 | ||
53 | public PresenceServerPostHandler(IPresenceService service) : | 54 | public PresenceServerPostHandler(IPresenceService service, IServiceAuth auth) : |
54 | base("POST", "/presence") | 55 | base("POST", "/presence", auth) |
55 | { | 56 | { |
56 | m_PresenceService = service; | 57 | m_PresenceService = service; |
57 | } | 58 | } |
diff --git a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerConnector.cs b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerConnector.cs index 344b513..e95e3dc 100644 --- a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerConnector.cs +++ b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerConnector.cs | |||
@@ -30,6 +30,7 @@ using Nini.Config; | |||
30 | using OpenSim.Server.Base; | 30 | using OpenSim.Server.Base; |
31 | using OpenSim.Services.Interfaces; | 31 | using OpenSim.Services.Interfaces; |
32 | using OpenSim.Framework.Servers.HttpServer; | 32 | using OpenSim.Framework.Servers.HttpServer; |
33 | using OpenSim.Framework.ServiceAuth; | ||
33 | using OpenSim.Server.Handlers.Base; | 34 | using OpenSim.Server.Handlers.Base; |
34 | 35 | ||
35 | namespace OpenSim.Server.Handlers.UserAccounts | 36 | namespace OpenSim.Server.Handlers.UserAccounts |
@@ -55,7 +56,9 @@ namespace OpenSim.Server.Handlers.UserAccounts | |||
55 | Object[] args = new Object[] { config }; | 56 | Object[] args = new Object[] { config }; |
56 | m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(service, args); | 57 | m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(service, args); |
57 | 58 | ||
58 | server.AddStreamHandler(new UserAccountServerPostHandler(m_UserAccountService, serverConfig)); | 59 | IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); |
60 | |||
61 | server.AddStreamHandler(new UserAccountServerPostHandler(m_UserAccountService, serverConfig, auth)); | ||
59 | } | 62 | } |
60 | } | 63 | } |
61 | } | 64 | } |
diff --git a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs index 24c9de6..c87e022 100644 --- a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs +++ b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs | |||
@@ -41,6 +41,7 @@ using OpenSim.Services.Interfaces; | |||
41 | using OpenSim.Services.UserAccountService; | 41 | using OpenSim.Services.UserAccountService; |
42 | using OpenSim.Framework; | 42 | using OpenSim.Framework; |
43 | using OpenSim.Framework.Servers.HttpServer; | 43 | using OpenSim.Framework.Servers.HttpServer; |
44 | using OpenSim.Framework.ServiceAuth; | ||
44 | using OpenMetaverse; | 45 | using OpenMetaverse; |
45 | 46 | ||
46 | namespace OpenSim.Server.Handlers.UserAccounts | 47 | namespace OpenSim.Server.Handlers.UserAccounts |
@@ -54,10 +55,10 @@ namespace OpenSim.Server.Handlers.UserAccounts | |||
54 | private bool m_AllowSetAccount = false; | 55 | private bool m_AllowSetAccount = false; |
55 | 56 | ||
56 | public UserAccountServerPostHandler(IUserAccountService service) | 57 | public UserAccountServerPostHandler(IUserAccountService service) |
57 | : this(service, null) {} | 58 | : this(service, null, null) {} |
58 | 59 | ||
59 | public UserAccountServerPostHandler(IUserAccountService service, IConfig config) : | 60 | public UserAccountServerPostHandler(IUserAccountService service, IConfig config, IServiceAuth auth) : |
60 | base("POST", "/accounts") | 61 | base("POST", "/accounts", auth) |
61 | { | 62 | { |
62 | m_UserAccountService = service; | 63 | m_UserAccountService = service; |
63 | 64 | ||
diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index 2ba8e04..0996acb 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs | |||
@@ -39,7 +39,7 @@ using OpenMetaverse; | |||
39 | 39 | ||
40 | namespace OpenSim.Services.Connectors | 40 | namespace OpenSim.Services.Connectors |
41 | { | 41 | { |
42 | public class AssetServicesConnector : IAssetService | 42 | public class AssetServicesConnector : BaseServiceConnector, IAssetService |
43 | { | 43 | { |
44 | private static readonly ILog m_log = | 44 | private static readonly ILog m_log = |
45 | LogManager.GetLogger( | 45 | LogManager.GetLogger( |
@@ -71,6 +71,7 @@ namespace OpenSim.Services.Connectors | |||
71 | } | 71 | } |
72 | 72 | ||
73 | public AssetServicesConnector(IConfigSource source) | 73 | public AssetServicesConnector(IConfigSource source) |
74 | : base(source, "AssetService") | ||
74 | { | 75 | { |
75 | Initialise(source); | 76 | Initialise(source); |
76 | } | 77 | } |
@@ -126,7 +127,7 @@ namespace OpenSim.Services.Connectors | |||
126 | // = SynchronousRestObjectRequester.MakeRequest<int, AssetBase>( | 127 | // = SynchronousRestObjectRequester.MakeRequest<int, AssetBase>( |
127 | // "GET", uri, 0, m_maxAssetRequestConcurrency); | 128 | // "GET", uri, 0, m_maxAssetRequestConcurrency); |
128 | 129 | ||
129 | asset = SynchronousRestObjectRequester.MakeRequest<int, AssetBase>("GET", uri, 0); | 130 | asset = SynchronousRestObjectRequester.MakeRequest<int, AssetBase>("GET", uri, 0, m_Auth); |
130 | 131 | ||
131 | if (m_Cache != null) | 132 | if (m_Cache != null) |
132 | m_Cache.Cache(asset); | 133 | m_Cache.Cache(asset); |
@@ -156,7 +157,7 @@ namespace OpenSim.Services.Connectors | |||
156 | 157 | ||
157 | string uri = m_ServerURI + "/assets/" + id + "/metadata"; | 158 | string uri = m_ServerURI + "/assets/" + id + "/metadata"; |
158 | 159 | ||
159 | AssetMetadata asset = SynchronousRestObjectRequester.MakeRequest<int, AssetMetadata>("GET", uri, 0); | 160 | AssetMetadata asset = SynchronousRestObjectRequester.MakeRequest<int, AssetMetadata>("GET", uri, 0, m_Auth); |
160 | return asset; | 161 | return asset; |
161 | } | 162 | } |
162 | 163 | ||
@@ -177,7 +178,7 @@ namespace OpenSim.Services.Connectors | |||
177 | 178 | ||
178 | rc.RequestMethod = "GET"; | 179 | rc.RequestMethod = "GET"; |
179 | 180 | ||
180 | Stream s = rc.Request(); | 181 | Stream s = rc.Request(m_Auth); |
181 | 182 | ||
182 | if (s == null) | 183 | if (s == null) |
183 | return null; | 184 | return null; |
@@ -238,7 +239,7 @@ namespace OpenSim.Services.Connectors | |||
238 | m_AssetHandlers.Remove(id); | 239 | m_AssetHandlers.Remove(id); |
239 | } | 240 | } |
240 | handlers.Invoke(a); | 241 | handlers.Invoke(a); |
241 | }, m_maxAssetRequestConcurrency); | 242 | }, m_maxAssetRequestConcurrency, m_Auth); |
242 | 243 | ||
243 | success = true; | 244 | success = true; |
244 | } | 245 | } |
@@ -268,7 +269,7 @@ namespace OpenSim.Services.Connectors | |||
268 | bool[] exist = null; | 269 | bool[] exist = null; |
269 | try | 270 | try |
270 | { | 271 | { |
271 | exist = SynchronousRestObjectRequester.MakeRequest<string[], bool[]>("POST", uri, ids); | 272 | exist = SynchronousRestObjectRequester.MakeRequest<string[], bool[]>("POST", uri, ids, m_Auth); |
272 | } | 273 | } |
273 | catch (Exception) | 274 | catch (Exception) |
274 | { | 275 | { |
@@ -297,7 +298,7 @@ namespace OpenSim.Services.Connectors | |||
297 | string newID; | 298 | string newID; |
298 | try | 299 | try |
299 | { | 300 | { |
300 | newID = SynchronousRestObjectRequester.MakeRequest<AssetBase, string>("POST", uri, asset); | 301 | newID = SynchronousRestObjectRequester.MakeRequest<AssetBase, string>("POST", uri, asset, m_Auth); |
301 | } | 302 | } |
302 | catch (Exception e) | 303 | catch (Exception e) |
303 | { | 304 | { |
@@ -343,7 +344,7 @@ namespace OpenSim.Services.Connectors | |||
343 | 344 | ||
344 | string uri = m_ServerURI + "/assets/" + id; | 345 | string uri = m_ServerURI + "/assets/" + id; |
345 | 346 | ||
346 | if (SynchronousRestObjectRequester.MakeRequest<AssetBase, bool>("POST", uri, asset)) | 347 | if (SynchronousRestObjectRequester.MakeRequest<AssetBase, bool>("POST", uri, asset, m_Auth)) |
347 | { | 348 | { |
348 | if (m_Cache != null) | 349 | if (m_Cache != null) |
349 | m_Cache.Cache(asset); | 350 | m_Cache.Cache(asset); |
@@ -357,7 +358,7 @@ namespace OpenSim.Services.Connectors | |||
357 | { | 358 | { |
358 | string uri = m_ServerURI + "/assets/" + id; | 359 | string uri = m_ServerURI + "/assets/" + id; |
359 | 360 | ||
360 | if (SynchronousRestObjectRequester.MakeRequest<int, bool>("DELETE", uri, 0)) | 361 | if (SynchronousRestObjectRequester.MakeRequest<int, bool>("DELETE", uri, 0, m_Auth)) |
361 | { | 362 | { |
362 | if (m_Cache != null) | 363 | if (m_Cache != null) |
363 | m_Cache.Expire(id); | 364 | m_Cache.Expire(id); |
diff --git a/OpenSim/Services/Connectors/Authentication/AuthenticationServicesConnector.cs b/OpenSim/Services/Connectors/Authentication/AuthenticationServicesConnector.cs index 2b77154..56b6434 100644 --- a/OpenSim/Services/Connectors/Authentication/AuthenticationServicesConnector.cs +++ b/OpenSim/Services/Connectors/Authentication/AuthenticationServicesConnector.cs | |||
@@ -32,14 +32,14 @@ using System.IO; | |||
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.ServiceAuth; |
36 | using OpenSim.Services.Interfaces; | 36 | using OpenSim.Services.Interfaces; |
37 | using OpenSim.Server.Base; | 37 | using OpenSim.Server.Base; |
38 | using OpenMetaverse; | 38 | using OpenMetaverse; |
39 | 39 | ||
40 | namespace OpenSim.Services.Connectors | 40 | namespace OpenSim.Services.Connectors |
41 | { | 41 | { |
42 | public class AuthenticationServicesConnector : IAuthenticationService | 42 | public class AuthenticationServicesConnector : BaseServiceConnector, IAuthenticationService |
43 | { | 43 | { |
44 | private static readonly ILog m_log = | 44 | private static readonly ILog m_log = |
45 | LogManager.GetLogger( | 45 | LogManager.GetLogger( |
@@ -57,6 +57,7 @@ namespace OpenSim.Services.Connectors | |||
57 | } | 57 | } |
58 | 58 | ||
59 | public AuthenticationServicesConnector(IConfigSource source) | 59 | public AuthenticationServicesConnector(IConfigSource source) |
60 | : base(source, "AuthenticationService") | ||
60 | { | 61 | { |
61 | Initialise(source); | 62 | Initialise(source); |
62 | } | 63 | } |
@@ -79,6 +80,8 @@ namespace OpenSim.Services.Connectors | |||
79 | throw new Exception("Authentication connector init error"); | 80 | throw new Exception("Authentication connector init error"); |
80 | } | 81 | } |
81 | m_ServerURI = serviceURI; | 82 | m_ServerURI = serviceURI; |
83 | |||
84 | base.Initialise(source, "AuthenticationService"); | ||
82 | } | 85 | } |
83 | 86 | ||
84 | public string Authenticate(UUID principalID, string password, int lifetime) | 87 | public string Authenticate(UUID principalID, string password, int lifetime) |
@@ -92,7 +95,7 @@ namespace OpenSim.Services.Connectors | |||
92 | 95 | ||
93 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 96 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
94 | m_ServerURI + "/auth/plain", | 97 | m_ServerURI + "/auth/plain", |
95 | ServerUtils.BuildQueryString(sendData)); | 98 | ServerUtils.BuildQueryString(sendData), m_Auth); |
96 | 99 | ||
97 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( | 100 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( |
98 | reply); | 101 | reply); |
@@ -105,6 +108,7 @@ namespace OpenSim.Services.Connectors | |||
105 | 108 | ||
106 | public bool Verify(UUID principalID, string token, int lifetime) | 109 | public bool Verify(UUID principalID, string token, int lifetime) |
107 | { | 110 | { |
111 | m_log.Error("[XXX]: Verify"); | ||
108 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 112 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
109 | sendData["LIFETIME"] = lifetime.ToString(); | 113 | sendData["LIFETIME"] = lifetime.ToString(); |
110 | sendData["PRINCIPAL"] = principalID.ToString(); | 114 | sendData["PRINCIPAL"] = principalID.ToString(); |
@@ -114,7 +118,7 @@ namespace OpenSim.Services.Connectors | |||
114 | 118 | ||
115 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 119 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
116 | m_ServerURI + "/auth/plain", | 120 | m_ServerURI + "/auth/plain", |
117 | ServerUtils.BuildQueryString(sendData)); | 121 | ServerUtils.BuildQueryString(sendData), m_Auth); |
118 | 122 | ||
119 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( | 123 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( |
120 | reply); | 124 | reply); |
@@ -135,7 +139,7 @@ namespace OpenSim.Services.Connectors | |||
135 | 139 | ||
136 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 140 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
137 | m_ServerURI + "/auth/plain", | 141 | m_ServerURI + "/auth/plain", |
138 | ServerUtils.BuildQueryString(sendData)); | 142 | ServerUtils.BuildQueryString(sendData), m_Auth); |
139 | 143 | ||
140 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( | 144 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( |
141 | reply); | 145 | reply); |
diff --git a/OpenSim/Services/Connectors/Avatar/AvatarServicesConnector.cs b/OpenSim/Services/Connectors/Avatar/AvatarServicesConnector.cs index ddfca57..3f44efa 100644 --- a/OpenSim/Services/Connectors/Avatar/AvatarServicesConnector.cs +++ b/OpenSim/Services/Connectors/Avatar/AvatarServicesConnector.cs | |||
@@ -32,7 +32,7 @@ using System.IO; | |||
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.ServiceAuth; |
36 | using OpenSim.Services.Interfaces; | 36 | using OpenSim.Services.Interfaces; |
37 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 37 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
38 | using IAvatarService = OpenSim.Services.Interfaces.IAvatarService; | 38 | using IAvatarService = OpenSim.Services.Interfaces.IAvatarService; |
@@ -41,7 +41,7 @@ using OpenMetaverse; | |||
41 | 41 | ||
42 | namespace OpenSim.Services.Connectors | 42 | namespace OpenSim.Services.Connectors |
43 | { | 43 | { |
44 | public class AvatarServicesConnector : IAvatarService | 44 | public class AvatarServicesConnector : BaseServiceConnector, IAvatarService |
45 | { | 45 | { |
46 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
47 | LogManager.GetLogger( | 47 | LogManager.GetLogger( |
@@ -59,6 +59,7 @@ namespace OpenSim.Services.Connectors | |||
59 | } | 59 | } |
60 | 60 | ||
61 | public AvatarServicesConnector(IConfigSource source) | 61 | public AvatarServicesConnector(IConfigSource source) |
62 | : base(source, "AvatarService") | ||
62 | { | 63 | { |
63 | Initialise(source); | 64 | Initialise(source); |
64 | } | 65 | } |
@@ -81,6 +82,8 @@ namespace OpenSim.Services.Connectors | |||
81 | throw new Exception("Avatar connector init error"); | 82 | throw new Exception("Avatar connector init error"); |
82 | } | 83 | } |
83 | m_ServerURI = serviceURI; | 84 | m_ServerURI = serviceURI; |
85 | |||
86 | base.Initialise(source, "AvatarService"); | ||
84 | } | 87 | } |
85 | 88 | ||
86 | 89 | ||
@@ -114,7 +117,7 @@ namespace OpenSim.Services.Connectors | |||
114 | // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); | 117 | // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); |
115 | try | 118 | try |
116 | { | 119 | { |
117 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); | 120 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); |
118 | if (reply == null || (reply != null && reply == string.Empty)) | 121 | if (reply == null || (reply != null && reply == string.Empty)) |
119 | { | 122 | { |
120 | m_log.DebugFormat("[AVATAR CONNECTOR]: GetAgent received null or empty reply"); | 123 | m_log.DebugFormat("[AVATAR CONNECTOR]: GetAgent received null or empty reply"); |
@@ -162,7 +165,7 @@ namespace OpenSim.Services.Connectors | |||
162 | //m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); | 165 | //m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); |
163 | try | 166 | try |
164 | { | 167 | { |
165 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); | 168 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); |
166 | if (reply != string.Empty) | 169 | if (reply != string.Empty) |
167 | { | 170 | { |
168 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 171 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -207,7 +210,7 @@ namespace OpenSim.Services.Connectors | |||
207 | // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); | 210 | // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); |
208 | try | 211 | try |
209 | { | 212 | { |
210 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); | 213 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); |
211 | if (reply != string.Empty) | 214 | if (reply != string.Empty) |
212 | { | 215 | { |
213 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 216 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -250,7 +253,7 @@ namespace OpenSim.Services.Connectors | |||
250 | // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); | 253 | // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); |
251 | try | 254 | try |
252 | { | 255 | { |
253 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); | 256 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); |
254 | if (reply != string.Empty) | 257 | if (reply != string.Empty) |
255 | { | 258 | { |
256 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 259 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -293,7 +296,7 @@ namespace OpenSim.Services.Connectors | |||
293 | // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); | 296 | // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); |
294 | try | 297 | try |
295 | { | 298 | { |
296 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); | 299 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); |
297 | if (reply != string.Empty) | 300 | if (reply != string.Empty) |
298 | { | 301 | { |
299 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 302 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
diff --git a/OpenSim/Services/Connectors/BaseServiceConnector.cs b/OpenSim/Services/Connectors/BaseServiceConnector.cs new file mode 100644 index 0000000..98cd489 --- /dev/null +++ b/OpenSim/Services/Connectors/BaseServiceConnector.cs | |||
@@ -0,0 +1,33 @@ | |||
1 | using System; | ||
2 | using OpenSim.Framework; | ||
3 | using OpenSim.Framework.ServiceAuth; | ||
4 | |||
5 | using Nini.Config; | ||
6 | |||
7 | namespace OpenSim.Services.Connectors | ||
8 | { | ||
9 | public class BaseServiceConnector | ||
10 | { | ||
11 | protected IServiceAuth m_Auth; | ||
12 | |||
13 | public BaseServiceConnector() { } | ||
14 | |||
15 | public BaseServiceConnector(IConfigSource config, string section) | ||
16 | { | ||
17 | Initialise(config, section); | ||
18 | } | ||
19 | |||
20 | public void Initialise(IConfigSource config, string section) | ||
21 | { | ||
22 | string authType = Util.GetConfigVarFromSections<string>(config, "AuthType", new string[] { "Network", section }, "None"); | ||
23 | |||
24 | switch (authType) | ||
25 | { | ||
26 | case "BasicHttpAuthentication": | ||
27 | m_Auth = new BasicHttpAuthentication(config, section); | ||
28 | break; | ||
29 | } | ||
30 | |||
31 | } | ||
32 | } | ||
33 | } | ||
diff --git a/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs index b1dd84e..74851a9 100644 --- a/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs +++ b/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs | |||
@@ -32,6 +32,7 @@ using System.IO; | |||
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.ServiceAuth; | ||
35 | using OpenSim.Framework.Communications; | 36 | using OpenSim.Framework.Communications; |
36 | using OpenSim.Services.Interfaces; | 37 | using OpenSim.Services.Interfaces; |
37 | using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; | 38 | using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; |
@@ -40,7 +41,7 @@ using OpenMetaverse; | |||
40 | 41 | ||
41 | namespace OpenSim.Services.Connectors.Friends | 42 | namespace OpenSim.Services.Connectors.Friends |
42 | { | 43 | { |
43 | public class FriendsServicesConnector : IFriendsService | 44 | public class FriendsServicesConnector : BaseServiceConnector, IFriendsService |
44 | { | 45 | { |
45 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
46 | LogManager.GetLogger( | 47 | LogManager.GetLogger( |
@@ -80,6 +81,7 @@ namespace OpenSim.Services.Connectors.Friends | |||
80 | throw new Exception("Friends connector init error"); | 81 | throw new Exception("Friends connector init error"); |
81 | } | 82 | } |
82 | m_ServerURI = serviceURI; | 83 | m_ServerURI = serviceURI; |
84 | base.Initialise(source, "FriendsService"); | ||
83 | } | 85 | } |
84 | 86 | ||
85 | 87 | ||
@@ -112,7 +114,7 @@ namespace OpenSim.Services.Connectors.Friends | |||
112 | 114 | ||
113 | try | 115 | try |
114 | { | 116 | { |
115 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); | 117 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); |
116 | if (reply != string.Empty) | 118 | if (reply != string.Empty) |
117 | { | 119 | { |
118 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 120 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -168,7 +170,7 @@ namespace OpenSim.Services.Connectors.Friends | |||
168 | string uri = m_ServerURI + "/friends"; | 170 | string uri = m_ServerURI + "/friends"; |
169 | try | 171 | try |
170 | { | 172 | { |
171 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData)); | 173 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData), m_Auth); |
172 | } | 174 | } |
173 | catch (Exception e) | 175 | catch (Exception e) |
174 | { | 176 | { |
@@ -223,7 +225,7 @@ namespace OpenSim.Services.Connectors.Friends | |||
223 | string uri = m_ServerURI + "/friends"; | 225 | string uri = m_ServerURI + "/friends"; |
224 | try | 226 | try |
225 | { | 227 | { |
226 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData)); | 228 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData), m_Auth); |
227 | } | 229 | } |
228 | catch (Exception e) | 230 | catch (Exception e) |
229 | { | 231 | { |
diff --git a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs index 0f5a613..7f86cff 100644 --- a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs | |||
@@ -33,6 +33,7 @@ using System.Reflection; | |||
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
36 | using OpenSim.Framework.ServiceAuth; | ||
36 | using OpenSim.Services.Interfaces; | 37 | using OpenSim.Services.Interfaces; |
37 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 38 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
38 | using OpenSim.Server.Base; | 39 | using OpenSim.Server.Base; |
@@ -40,7 +41,7 @@ using OpenMetaverse; | |||
40 | 41 | ||
41 | namespace OpenSim.Services.Connectors | 42 | namespace OpenSim.Services.Connectors |
42 | { | 43 | { |
43 | public class GridServicesConnector : IGridService | 44 | public class GridServicesConnector : BaseServiceConnector, IGridService |
44 | { | 45 | { |
45 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
46 | LogManager.GetLogger( | 47 | LogManager.GetLogger( |
@@ -80,6 +81,8 @@ namespace OpenSim.Services.Connectors | |||
80 | throw new Exception("Grid connector init error"); | 81 | throw new Exception("Grid connector init error"); |
81 | } | 82 | } |
82 | m_ServerURI = serviceURI; | 83 | m_ServerURI = serviceURI; |
84 | |||
85 | base.Initialise(source, "GridService"); | ||
83 | } | 86 | } |
84 | 87 | ||
85 | 88 | ||
@@ -102,7 +105,7 @@ namespace OpenSim.Services.Connectors | |||
102 | // m_log.DebugFormat("[GRID CONNECTOR]: queryString = {0}", reqString); | 105 | // m_log.DebugFormat("[GRID CONNECTOR]: queryString = {0}", reqString); |
103 | try | 106 | try |
104 | { | 107 | { |
105 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); | 108 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); |
106 | if (reply != string.Empty) | 109 | if (reply != string.Empty) |
107 | { | 110 | { |
108 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 111 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -158,7 +161,7 @@ namespace OpenSim.Services.Connectors | |||
158 | try | 161 | try |
159 | { | 162 | { |
160 | string reply | 163 | string reply |
161 | = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData)); | 164 | = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData), m_Auth); |
162 | 165 | ||
163 | if (reply != string.Empty) | 166 | if (reply != string.Empty) |
164 | { | 167 | { |
@@ -195,7 +198,7 @@ namespace OpenSim.Services.Connectors | |||
195 | 198 | ||
196 | try | 199 | try |
197 | { | 200 | { |
198 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); | 201 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); |
199 | } | 202 | } |
200 | catch (Exception e) | 203 | catch (Exception e) |
201 | { | 204 | { |
@@ -238,7 +241,7 @@ namespace OpenSim.Services.Connectors | |||
238 | string uri = m_ServerURI + "/grid"; | 241 | string uri = m_ServerURI + "/grid"; |
239 | try | 242 | try |
240 | { | 243 | { |
241 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData)); | 244 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData), m_Auth); |
242 | } | 245 | } |
243 | catch (Exception e) | 246 | catch (Exception e) |
244 | { | 247 | { |
@@ -285,7 +288,7 @@ namespace OpenSim.Services.Connectors | |||
285 | { | 288 | { |
286 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 289 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
287 | uri, | 290 | uri, |
288 | ServerUtils.BuildQueryString(sendData)); | 291 | ServerUtils.BuildQueryString(sendData), m_Auth); |
289 | } | 292 | } |
290 | catch (Exception e) | 293 | catch (Exception e) |
291 | { | 294 | { |
@@ -330,7 +333,7 @@ namespace OpenSim.Services.Connectors | |||
330 | { | 333 | { |
331 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 334 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
332 | uri, | 335 | uri, |
333 | ServerUtils.BuildQueryString(sendData)); | 336 | ServerUtils.BuildQueryString(sendData), m_Auth); |
334 | } | 337 | } |
335 | catch (Exception e) | 338 | catch (Exception e) |
336 | { | 339 | { |
@@ -374,7 +377,7 @@ namespace OpenSim.Services.Connectors | |||
374 | { | 377 | { |
375 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 378 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
376 | uri, | 379 | uri, |
377 | ServerUtils.BuildQueryString(sendData)); | 380 | ServerUtils.BuildQueryString(sendData), m_Auth); |
378 | } | 381 | } |
379 | catch (Exception e) | 382 | catch (Exception e) |
380 | { | 383 | { |
@@ -428,7 +431,7 @@ namespace OpenSim.Services.Connectors | |||
428 | { | 431 | { |
429 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 432 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
430 | uri, | 433 | uri, |
431 | ServerUtils.BuildQueryString(sendData)); | 434 | ServerUtils.BuildQueryString(sendData), m_Auth); |
432 | 435 | ||
433 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); | 436 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); |
434 | } | 437 | } |
@@ -479,7 +482,7 @@ namespace OpenSim.Services.Connectors | |||
479 | { | 482 | { |
480 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 483 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
481 | uri, | 484 | uri, |
482 | ServerUtils.BuildQueryString(sendData)); | 485 | ServerUtils.BuildQueryString(sendData), m_Auth); |
483 | 486 | ||
484 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); | 487 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); |
485 | } | 488 | } |
@@ -530,7 +533,7 @@ namespace OpenSim.Services.Connectors | |||
530 | { | 533 | { |
531 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 534 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
532 | uri, | 535 | uri, |
533 | ServerUtils.BuildQueryString(sendData)); | 536 | ServerUtils.BuildQueryString(sendData), m_Auth); |
534 | 537 | ||
535 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); | 538 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); |
536 | } | 539 | } |
@@ -583,7 +586,7 @@ namespace OpenSim.Services.Connectors | |||
583 | { | 586 | { |
584 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 587 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
585 | uri, | 588 | uri, |
586 | ServerUtils.BuildQueryString(sendData)); | 589 | ServerUtils.BuildQueryString(sendData), m_Auth); |
587 | 590 | ||
588 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); | 591 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); |
589 | } | 592 | } |
@@ -634,7 +637,7 @@ namespace OpenSim.Services.Connectors | |||
634 | { | 637 | { |
635 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 638 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
636 | uri, | 639 | uri, |
637 | ServerUtils.BuildQueryString(sendData)); | 640 | ServerUtils.BuildQueryString(sendData), m_Auth); |
638 | 641 | ||
639 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); | 642 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); |
640 | } | 643 | } |
@@ -685,7 +688,7 @@ namespace OpenSim.Services.Connectors | |||
685 | { | 688 | { |
686 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 689 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
687 | uri, | 690 | uri, |
688 | ServerUtils.BuildQueryString(sendData)); | 691 | ServerUtils.BuildQueryString(sendData), m_Auth); |
689 | } | 692 | } |
690 | catch (Exception e) | 693 | catch (Exception e) |
691 | { | 694 | { |
diff --git a/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs b/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs index 1a62d2f..ffdd94a 100644 --- a/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs +++ b/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs | |||
@@ -33,6 +33,7 @@ using System.Reflection; | |||
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
36 | using OpenSim.Framework.ServiceAuth; | ||
36 | using OpenSim.Services.Interfaces; | 37 | using OpenSim.Services.Interfaces; |
37 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 38 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
38 | using OpenSim.Server.Base; | 39 | using OpenSim.Server.Base; |
@@ -40,7 +41,7 @@ using OpenMetaverse; | |||
40 | 41 | ||
41 | namespace OpenSim.Services.Connectors | 42 | namespace OpenSim.Services.Connectors |
42 | { | 43 | { |
43 | public class GridUserServicesConnector : IGridUserService | 44 | public class GridUserServicesConnector : BaseServiceConnector, IGridUserService |
44 | { | 45 | { |
45 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
46 | LogManager.GetLogger( | 47 | LogManager.GetLogger( |
@@ -80,6 +81,7 @@ namespace OpenSim.Services.Connectors | |||
80 | throw new Exception("GridUser connector init error"); | 81 | throw new Exception("GridUser connector init error"); |
81 | } | 82 | } |
82 | m_ServerURI = serviceURI; | 83 | m_ServerURI = serviceURI; |
84 | base.Initialise(source, "GridUserService"); | ||
83 | } | 85 | } |
84 | 86 | ||
85 | 87 | ||
@@ -162,7 +164,8 @@ namespace OpenSim.Services.Connectors | |||
162 | { | 164 | { |
163 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 165 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
164 | uri, | 166 | uri, |
165 | reqString); | 167 | reqString, |
168 | m_Auth); | ||
166 | if (reply != string.Empty) | 169 | if (reply != string.Empty) |
167 | { | 170 | { |
168 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 171 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -198,7 +201,8 @@ namespace OpenSim.Services.Connectors | |||
198 | { | 201 | { |
199 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 202 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
200 | uri, | 203 | uri, |
201 | reqString); | 204 | reqString, |
205 | m_Auth); | ||
202 | if (reply != string.Empty) | 206 | if (reply != string.Empty) |
203 | { | 207 | { |
204 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 208 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -243,7 +247,8 @@ namespace OpenSim.Services.Connectors | |||
243 | { | 247 | { |
244 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 248 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
245 | uri, | 249 | uri, |
246 | reqString); | 250 | reqString, |
251 | m_Auth); | ||
247 | if (reply == null || (reply != null && reply == string.Empty)) | 252 | if (reply == null || (reply != null && reply == string.Empty)) |
248 | { | 253 | { |
249 | m_log.DebugFormat("[GRID USER CONNECTOR]: GetGridUserInfo received null or empty reply"); | 254 | m_log.DebugFormat("[GRID USER CONNECTOR]: GetGridUserInfo received null or empty reply"); |
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs index 85d105e..f86d2f1 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs | |||
@@ -40,7 +40,7 @@ using OpenMetaverse; | |||
40 | 40 | ||
41 | namespace OpenSim.Services.Connectors | 41 | namespace OpenSim.Services.Connectors |
42 | { | 42 | { |
43 | public class XInventoryServicesConnector : IInventoryService | 43 | public class XInventoryServicesConnector : BaseServiceConnector, IInventoryService |
44 | { | 44 | { |
45 | private static readonly ILog m_log = | 45 | private static readonly ILog m_log = |
46 | LogManager.GetLogger( | 46 | LogManager.GetLogger( |
@@ -60,6 +60,7 @@ namespace OpenSim.Services.Connectors | |||
60 | } | 60 | } |
61 | 61 | ||
62 | public XInventoryServicesConnector(IConfigSource source) | 62 | public XInventoryServicesConnector(IConfigSource source) |
63 | : base(source, "InventoryService") | ||
63 | { | 64 | { |
64 | Initialise(source); | 65 | Initialise(source); |
65 | } | 66 | } |
@@ -505,7 +506,7 @@ namespace OpenSim.Services.Connectors | |||
505 | lock (m_Lock) | 506 | lock (m_Lock) |
506 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 507 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
507 | m_ServerURI + "/xinventory", | 508 | m_ServerURI + "/xinventory", |
508 | ServerUtils.BuildQueryString(sendData)); | 509 | ServerUtils.BuildQueryString(sendData), m_Auth); |
509 | 510 | ||
510 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( | 511 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( |
511 | reply); | 512 | reply); |
diff --git a/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs b/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs index 725204d..677825e 100644 --- a/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs +++ b/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs | |||
@@ -36,6 +36,7 @@ using Nini.Config; | |||
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Console; | 37 | using OpenSim.Framework.Console; |
38 | using OpenSim.Framework.Communications; | 38 | using OpenSim.Framework.Communications; |
39 | using OpenSim.Framework.ServiceAuth; | ||
39 | using OpenSim.Server.Base; | 40 | using OpenSim.Server.Base; |
40 | using OpenSim.Services.Interfaces; | 41 | using OpenSim.Services.Interfaces; |
41 | using OpenMetaverse; | 42 | using OpenMetaverse; |
@@ -43,7 +44,7 @@ using OpenMetaverse.StructuredData; | |||
43 | 44 | ||
44 | namespace OpenSim.Services.Connectors | 45 | namespace OpenSim.Services.Connectors |
45 | { | 46 | { |
46 | public class MapImageServicesConnector : IMapImageService | 47 | public class MapImageServicesConnector : BaseServiceConnector, IMapImageService |
47 | { | 48 | { |
48 | private static readonly ILog m_log = | 49 | private static readonly ILog m_log = |
49 | LogManager.GetLogger( | 50 | LogManager.GetLogger( |
@@ -84,6 +85,7 @@ namespace OpenSim.Services.Connectors | |||
84 | } | 85 | } |
85 | m_ServerURI = serviceURI; | 86 | m_ServerURI = serviceURI; |
86 | m_ServerURI = serviceURI.TrimEnd('/'); | 87 | m_ServerURI = serviceURI.TrimEnd('/'); |
88 | base.Initialise(source, "MapImageService"); | ||
87 | } | 89 | } |
88 | 90 | ||
89 | public bool RemoveMapTile(int x, int y, out string reason) | 91 | public bool RemoveMapTile(int x, int y, out string reason) |
@@ -101,7 +103,8 @@ namespace OpenSim.Services.Connectors | |||
101 | { | 103 | { |
102 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 104 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
103 | uri, | 105 | uri, |
104 | reqString); | 106 | reqString, |
107 | m_Auth); | ||
105 | if (reply != string.Empty) | 108 | if (reply != string.Empty) |
106 | { | 109 | { |
107 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 110 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -163,7 +166,8 @@ namespace OpenSim.Services.Connectors | |||
163 | { | 166 | { |
164 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 167 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
165 | uri, | 168 | uri, |
166 | reqString); | 169 | reqString, |
170 | m_Auth); | ||
167 | if (reply != string.Empty) | 171 | if (reply != string.Empty) |
168 | { | 172 | { |
169 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 173 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
diff --git a/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs b/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs index f7d8c53..aade714 100644 --- a/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs +++ b/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs | |||
@@ -33,6 +33,7 @@ using System.Reflection; | |||
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
36 | using OpenSim.Framework.ServiceAuth; | ||
36 | using OpenSim.Services.Interfaces; | 37 | using OpenSim.Services.Interfaces; |
37 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 38 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
38 | using OpenSim.Server.Base; | 39 | using OpenSim.Server.Base; |
@@ -40,7 +41,7 @@ using OpenMetaverse; | |||
40 | 41 | ||
41 | namespace OpenSim.Services.Connectors | 42 | namespace OpenSim.Services.Connectors |
42 | { | 43 | { |
43 | public class PresenceServicesConnector : IPresenceService | 44 | public class PresenceServicesConnector : BaseServiceConnector, IPresenceService |
44 | { | 45 | { |
45 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
46 | LogManager.GetLogger( | 47 | LogManager.GetLogger( |
@@ -80,6 +81,8 @@ namespace OpenSim.Services.Connectors | |||
80 | throw new Exception("Presence connector init error"); | 81 | throw new Exception("Presence connector init error"); |
81 | } | 82 | } |
82 | m_ServerURI = serviceURI; | 83 | m_ServerURI = serviceURI; |
84 | |||
85 | base.Initialise(source, "PresenceService"); | ||
83 | } | 86 | } |
84 | 87 | ||
85 | 88 | ||
@@ -104,7 +107,8 @@ namespace OpenSim.Services.Connectors | |||
104 | { | 107 | { |
105 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 108 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
106 | uri, | 109 | uri, |
107 | reqString); | 110 | reqString, |
111 | m_Auth); | ||
108 | if (reply != string.Empty) | 112 | if (reply != string.Empty) |
109 | { | 113 | { |
110 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 114 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -149,7 +153,8 @@ namespace OpenSim.Services.Connectors | |||
149 | { | 153 | { |
150 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 154 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
151 | uri, | 155 | uri, |
152 | reqString); | 156 | reqString, |
157 | m_Auth); | ||
153 | if (reply != string.Empty) | 158 | if (reply != string.Empty) |
154 | { | 159 | { |
155 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 160 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -193,7 +198,8 @@ namespace OpenSim.Services.Connectors | |||
193 | { | 198 | { |
194 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 199 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
195 | uri, | 200 | uri, |
196 | reqString); | 201 | reqString, |
202 | m_Auth); | ||
197 | if (reply != string.Empty) | 203 | if (reply != string.Empty) |
198 | { | 204 | { |
199 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 205 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -238,7 +244,8 @@ namespace OpenSim.Services.Connectors | |||
238 | { | 244 | { |
239 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 245 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
240 | uri, | 246 | uri, |
241 | reqString); | 247 | reqString, |
248 | m_Auth); | ||
242 | if (reply != string.Empty) | 249 | if (reply != string.Empty) |
243 | { | 250 | { |
244 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 251 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -283,7 +290,8 @@ namespace OpenSim.Services.Connectors | |||
283 | { | 290 | { |
284 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 291 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
285 | uri, | 292 | uri, |
286 | reqString); | 293 | reqString, |
294 | m_Auth); | ||
287 | if (reply == null || (reply != null && reply == string.Empty)) | 295 | if (reply == null || (reply != null && reply == string.Empty)) |
288 | { | 296 | { |
289 | m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgent received null or empty reply"); | 297 | m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgent received null or empty reply"); |
@@ -327,7 +335,8 @@ namespace OpenSim.Services.Connectors | |||
327 | { | 335 | { |
328 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 336 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
329 | uri, | 337 | uri, |
330 | reqString); | 338 | reqString, |
339 | m_Auth); | ||
331 | if (reply == null || (reply != null && reply == string.Empty)) | 340 | if (reply == null || (reply != null && reply == string.Empty)) |
332 | { | 341 | { |
333 | m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgents received null or empty reply"); | 342 | m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgents received null or empty reply"); |
diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs index 8110fe5..3f61d9a 100644 --- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs +++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs | |||
@@ -33,13 +33,14 @@ using System.Reflection; | |||
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
36 | using OpenSim.Framework.ServiceAuth; | ||
36 | using OpenSim.Server.Base; | 37 | using OpenSim.Server.Base; |
37 | using OpenSim.Services.Interfaces; | 38 | using OpenSim.Services.Interfaces; |
38 | using OpenMetaverse; | 39 | using OpenMetaverse; |
39 | 40 | ||
40 | namespace OpenSim.Services.Connectors | 41 | namespace OpenSim.Services.Connectors |
41 | { | 42 | { |
42 | public class UserAccountServicesConnector : IUserAccountService | 43 | public class UserAccountServicesConnector : BaseServiceConnector, IUserAccountService |
43 | { | 44 | { |
44 | private static readonly ILog m_log = | 45 | private static readonly ILog m_log = |
45 | LogManager.GetLogger( | 46 | LogManager.GetLogger( |
@@ -79,6 +80,8 @@ namespace OpenSim.Services.Connectors | |||
79 | throw new Exception("User account connector init error"); | 80 | throw new Exception("User account connector init error"); |
80 | } | 81 | } |
81 | m_ServerURI = serviceURI; | 82 | m_ServerURI = serviceURI; |
83 | |||
84 | base.Initialise(source, "UserAccountService"); | ||
82 | } | 85 | } |
83 | 86 | ||
84 | public virtual UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) | 87 | public virtual UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) |
@@ -144,7 +147,8 @@ namespace OpenSim.Services.Connectors | |||
144 | { | 147 | { |
145 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 148 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
146 | uri, | 149 | uri, |
147 | reqString); | 150 | reqString, |
151 | m_Auth); | ||
148 | if (reply == null || (reply != null && reply == string.Empty)) | 152 | if (reply == null || (reply != null && reply == string.Empty)) |
149 | { | 153 | { |
150 | m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetUserAccounts received null or empty reply"); | 154 | m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetUserAccounts received null or empty reply"); |
@@ -224,7 +228,8 @@ namespace OpenSim.Services.Connectors | |||
224 | { | 228 | { |
225 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 229 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
226 | uri, | 230 | uri, |
227 | reqString); | 231 | reqString, |
232 | m_Auth); | ||
228 | if (reply == null || (reply != null && reply == string.Empty)) | 233 | if (reply == null || (reply != null && reply == string.Empty)) |
229 | { | 234 | { |
230 | m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetUserAccount received null or empty reply"); | 235 | m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetUserAccount received null or empty reply"); |
@@ -260,7 +265,8 @@ namespace OpenSim.Services.Connectors | |||
260 | { | 265 | { |
261 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 266 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
262 | uri, | 267 | uri, |
263 | reqString); | 268 | reqString, |
269 | m_Auth); | ||
264 | if (reply != string.Empty) | 270 | if (reply != string.Empty) |
265 | { | 271 | { |
266 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 272 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index f3cd603..3f9aed6 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example | |||
@@ -470,6 +470,16 @@ | |||
470 | ;; web server | 470 | ;; web server |
471 | ; user_agent = "OpenSim LSL (Mozilla Compatible)" | 471 | ; user_agent = "OpenSim LSL (Mozilla Compatible)" |
472 | 472 | ||
473 | ;; The follow 3 variables are for HTTP Basic Authentication for the Robust services. | ||
474 | ;; Use this if your central services in port 8003 need to be accessible on the Internet | ||
475 | ;; but you want to protect them from unauthorized access. The username and password | ||
476 | ;; here need to match the ones in the Robust service configuration. | ||
477 | ; AuthType = "BasicHttpAuthentication" | ||
478 | ; HttpAuthUsername = "some_username" | ||
479 | ; HttpAuthPassword = "some_password" | ||
480 | ;; | ||
481 | ;; Any of these 3 variables above can be overriden in any of the service sections. | ||
482 | |||
473 | 483 | ||
474 | [XMLRPC] | 484 | [XMLRPC] |
475 | ;# {XmlRpcRouterModule} {} {Module used to route incoming llRemoteData calls} {XmlRpcRouterModule XmlRpcGridRouterModule} XmlRpcRouterModule | 485 | ;# {XmlRpcRouterModule} {} {Module used to route incoming llRemoteData calls} {XmlRpcRouterModule XmlRpcGridRouterModule} XmlRpcRouterModule |
diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index e385200..aaa78ff 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example | |||
@@ -104,6 +104,21 @@ HGAssetServiceConnector = "HGAssetService@8002/OpenSim.Server.Handlers.dll:Asset | |||
104 | ; Password for cert | 104 | ; Password for cert |
105 | ; cert_pass = "password" | 105 | ; cert_pass = "password" |
106 | 106 | ||
107 | ;; The follow 3 variables are for HTTP Basic Authentication for the Robust services. | ||
108 | ;; Use this if your central services in port 8003 need to be accessible on the Internet | ||
109 | ;; but you want to protect them from unauthorized access. | ||
110 | ; AuthType = "BasicHttpAuthentication" | ||
111 | ; HttpAuthUsername = "some_username" | ||
112 | ; HttpAuthPassword = "some_password" | ||
113 | ;; | ||
114 | ;; AuthType above can be overriden in any of the service sections below by | ||
115 | ; AuthType = "None" | ||
116 | ;; This is useful in cases where you want to protect most of the services, | ||
117 | ;; but unprotect individual services. Username and Password can also be | ||
118 | ;; overriden if you want to use different credentials for the different services. | ||
119 | ;; Hypgergrid services are not affected by this; they are publicly available | ||
120 | ;; by design. | ||
121 | |||
107 | 122 | ||
108 | ; * The following are for the remote console | 123 | ; * The following are for the remote console |
109 | ; * They have no effect for the local or basic console types | 124 | ; * They have no effect for the local or basic console types |
diff --git a/bin/Robust.ini.example b/bin/Robust.ini.example index 2f1a627..203c0e0 100644 --- a/bin/Robust.ini.example +++ b/bin/Robust.ini.example | |||
@@ -81,6 +81,19 @@ MapGetServiceConnector = "8002/OpenSim.Server.Handlers.dll:MapGetServiceConnecto | |||
81 | ; Password for cert | 81 | ; Password for cert |
82 | ; cert_pass = "password" | 82 | ; cert_pass = "password" |
83 | 83 | ||
84 | ;; The follow 3 variables are for HTTP Basic Authentication for the Robust services. | ||
85 | ;; Use this if your central services in port 8003 need to be accessible on the Internet | ||
86 | ;; but you want to protect them from unauthorized access. | ||
87 | ; AuthType = "BasicHttpAuthentication" | ||
88 | ; HttpAuthUsername = "some_username" | ||
89 | ; HttpAuthPassword = "some_password" | ||
90 | ;; | ||
91 | ;; AuthType above can be overriden in any of the service sections below by | ||
92 | ; AuthType = "None" | ||
93 | ;; This is useful in cases where you want to protect most of the services, | ||
94 | ;; but unprotect individual services. Username and Password can also be | ||
95 | ;; overriden if you want to use different credentials for the different services. | ||
96 | |||
84 | 97 | ||
85 | ; * The following are for the remote console | 98 | ; * The following are for the remote console |
86 | ; * They have no effect for the local or basic console types | 99 | ; * They have no effect for the local or basic console types |
diff --git a/prebuild.xml b/prebuild.xml index 196bfd2..3da7639 100644 --- a/prebuild.xml +++ b/prebuild.xml | |||
@@ -111,6 +111,7 @@ | |||
111 | <Files> | 111 | <Files> |
112 | <Match pattern="*.cs" recurse="false"/> | 112 | <Match pattern="*.cs" recurse="false"/> |
113 | <Match path="Client" pattern="*.cs" recurse="true"/> | 113 | <Match path="Client" pattern="*.cs" recurse="true"/> |
114 | <Match path="ServiceAuth" pattern="*.cs" recurse="true"/> | ||
114 | </Files> | 115 | </Files> |
115 | </Project> | 116 | </Project> |
116 | 117 | ||