Adds optional HTTP Basic Authentication to Robust service connectors.
parent
b7c7293c7a
commit
20f20895cf
|
@ -35,6 +35,8 @@ using System.Threading;
|
|||
using System.Web;
|
||||
using log4net;
|
||||
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
|
||||
namespace OpenSim.Framework.Communications
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -297,7 +299,7 @@ namespace OpenSim.Framework.Communications
|
|||
/// <summary>
|
||||
/// Perform a synchronous request
|
||||
/// </summary>
|
||||
public Stream Request()
|
||||
public Stream Request(IServiceAuth auth)
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
|
@ -307,6 +309,8 @@ namespace OpenSim.Framework.Communications
|
|||
_request.Timeout = 200000;
|
||||
_request.Method = RequestMethod;
|
||||
_asyncException = null;
|
||||
if (auth != null)
|
||||
auth.AddAuthorization(_request.Headers);
|
||||
|
||||
// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request);
|
||||
try
|
||||
|
@ -358,7 +362,7 @@ namespace OpenSim.Framework.Communications
|
|||
}
|
||||
}
|
||||
|
||||
public Stream Request(Stream src)
|
||||
public Stream Request(Stream src, IServiceAuth auth)
|
||||
{
|
||||
_request = (HttpWebRequest) WebRequest.Create(buildUri());
|
||||
_request.KeepAlive = false;
|
||||
|
@ -367,6 +371,8 @@ namespace OpenSim.Framework.Communications
|
|||
_request.Method = RequestMethod;
|
||||
_asyncException = null;
|
||||
_request.ContentLength = src.Length;
|
||||
if (auth != null)
|
||||
auth.AddAuthorization(_request.Headers);
|
||||
|
||||
m_log.InfoFormat("[REST]: Request Length {0}", _request.ContentLength);
|
||||
m_log.InfoFormat("[REST]: Sending Web Request {0}", buildUri());
|
||||
|
@ -384,7 +390,22 @@ namespace OpenSim.Framework.Communications
|
|||
length = src.Read(buf, 0, 1024);
|
||||
}
|
||||
|
||||
_response = (HttpWebResponse) _request.GetResponse();
|
||||
try
|
||||
{
|
||||
_response = (HttpWebResponse)_request.GetResponse();
|
||||
}
|
||||
catch (WebException e)
|
||||
{
|
||||
m_log.WarnFormat("[REST]: Request {0} {1} failed with status {2} and message {3}",
|
||||
RequestMethod, _request.RequestUri, e.Status, e.Message);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[REST]: Request {0} {1} failed with exception {2} {3}",
|
||||
RequestMethod, _request.RequestUri, e.Message, e.StackTrace);
|
||||
}
|
||||
|
||||
|
||||
// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request);
|
||||
|
||||
|
@ -423,7 +444,7 @@ namespace OpenSim.Framework.Communications
|
|||
try
|
||||
{
|
||||
// Perform the operation; if sucessful set the result
|
||||
Stream s = Request();
|
||||
Stream s = Request(null);
|
||||
ar.SetAsCompleted(s, false);
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
*/
|
||||
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
|
||||
namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
|
@ -37,15 +39,30 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
/// </remarks>
|
||||
public abstract class BaseStreamHandler : BaseRequestHandler, IStreamedRequestHandler
|
||||
{
|
||||
protected BaseStreamHandler(string httpMethod, string path) : this(httpMethod, path, null, null) {}
|
||||
protected IServiceAuth m_Auth;
|
||||
|
||||
protected BaseStreamHandler(string httpMethod, string path) : this(httpMethod, path, null, null) { }
|
||||
|
||||
protected BaseStreamHandler(string httpMethod, string path, string name, string description)
|
||||
: base(httpMethod, path, name, description) {}
|
||||
|
||||
protected BaseStreamHandler(string httpMethod, string path, IServiceAuth auth)
|
||||
: base(httpMethod, path, null, null)
|
||||
{
|
||||
m_Auth = auth;
|
||||
}
|
||||
|
||||
public virtual byte[] Handle(
|
||||
string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
RequestsReceived++;
|
||||
if (m_Auth != null && !m_Auth.Authenticate(httpRequest.Headers, httpResponse.AddHeader))
|
||||
{
|
||||
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.Unauthorized;
|
||||
httpResponse.ContentType = "text/plain";
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
byte[] result = ProcessRequest(path, request, httpRequest, httpResponse);
|
||||
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Reflection;
|
||||
|
||||
using Nini.Config;
|
||||
using log4net;
|
||||
|
||||
namespace OpenSim.Framework.ServiceAuth
|
||||
{
|
||||
public class BasicHttpAuthentication : IServiceAuth
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private string m_Username, m_Password;
|
||||
private string m_CredentialsB64;
|
||||
|
||||
private string remove_me;
|
||||
|
||||
public string Credentials
|
||||
{
|
||||
get { return m_CredentialsB64; }
|
||||
}
|
||||
|
||||
public BasicHttpAuthentication(IConfigSource config, string section)
|
||||
{
|
||||
remove_me = section;
|
||||
m_Username = Util.GetConfigVarFromSections<string>(config, "HttpAuthUsername", new string[] { "Network", section }, string.Empty);
|
||||
m_Password = Util.GetConfigVarFromSections<string>(config, "HttpAuthPassword", new string[] { "Network", section }, string.Empty);
|
||||
string str = m_Username + ":" + m_Password;
|
||||
byte[] encData_byte = Util.UTF8.GetBytes(str);
|
||||
|
||||
m_CredentialsB64 = Convert.ToBase64String(encData_byte);
|
||||
m_log.DebugFormat("[HTTP BASIC AUTH]: {0} {1} [{2}]", m_Username, m_Password, section);
|
||||
}
|
||||
|
||||
public void AddAuthorization(NameValueCollection headers)
|
||||
{
|
||||
//m_log.DebugFormat("[HTTP BASIC AUTH]: Adding authorization for {0}", remove_me);
|
||||
headers["Authorization"] = "Basic " + m_CredentialsB64;
|
||||
}
|
||||
|
||||
public bool Authenticate(string data)
|
||||
{
|
||||
string recovered = Util.Base64ToString(data);
|
||||
if (!String.IsNullOrEmpty(recovered))
|
||||
{
|
||||
string[] parts = recovered.Split(new char[] { ':' });
|
||||
if (parts.Length >= 2)
|
||||
{
|
||||
return m_Username.Equals(parts[0]) && m_Password.Equals(parts[1]);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool Authenticate(NameValueCollection requestHeaders, AddHeaderDelegate d)
|
||||
{
|
||||
//m_log.DebugFormat("[HTTP BASIC AUTH]: Authenticate in {0}", remove_me);
|
||||
if (requestHeaders != null)
|
||||
{
|
||||
string value = requestHeaders.Get("Authorization");
|
||||
if (value != null)
|
||||
{
|
||||
value = value.Trim();
|
||||
if (value.StartsWith("Basic "))
|
||||
{
|
||||
value = value.Replace("Basic ", string.Empty);
|
||||
if (Authenticate(value))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
d("WWW-Authenticate", "Basic realm = \"Asset Server\"");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
|
||||
namespace OpenSim.Framework.ServiceAuth
|
||||
{
|
||||
public delegate void AddHeaderDelegate(string key, string value);
|
||||
|
||||
public interface IServiceAuth
|
||||
{
|
||||
bool Authenticate(string data);
|
||||
bool Authenticate(NameValueCollection headers, AddHeaderDelegate d);
|
||||
void AddAuthorization(NameValueCollection headers);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Nini.Config;
|
||||
|
||||
namespace OpenSim.Framework.ServiceAuth
|
||||
{
|
||||
public class ServiceAuth
|
||||
{
|
||||
public static IServiceAuth Create(IConfigSource config, string section)
|
||||
{
|
||||
string authType = Util.GetConfigVarFromSections<string>(config, "AuthType", new string[] { "Network", section }, "None");
|
||||
|
||||
switch (authType)
|
||||
{
|
||||
case "BasicHttpAuthentication":
|
||||
return new BasicHttpAuthentication(config, section);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -45,6 +45,8 @@ using Nwc.XmlRpc;
|
|||
using OpenMetaverse.StructuredData;
|
||||
using XMLResponseHelper = OpenSim.Framework.SynchronousRestObjectRequester.XMLResponseHelper;
|
||||
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -772,6 +774,13 @@ namespace OpenSim.Framework
|
|||
public static void MakeRequest<TRequest, TResponse>(string verb,
|
||||
string requestUrl, TRequest obj, Action<TResponse> action,
|
||||
int maxConnections)
|
||||
{
|
||||
MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, action, maxConnections, null);
|
||||
}
|
||||
|
||||
public static void MakeRequest<TRequest, TResponse>(string verb,
|
||||
string requestUrl, TRequest obj, Action<TResponse> action,
|
||||
int maxConnections, IServiceAuth auth)
|
||||
{
|
||||
int reqnum = WebUtil.RequestNumber++;
|
||||
|
||||
|
@ -786,6 +795,10 @@ namespace OpenSim.Framework
|
|||
|
||||
WebRequest request = WebRequest.Create(requestUrl);
|
||||
HttpWebRequest ht = (HttpWebRequest)request;
|
||||
|
||||
if (auth != null)
|
||||
auth.AddAuthorization(ht.Headers);
|
||||
|
||||
if (maxConnections > 0 && ht.ServicePoint.ConnectionLimit < maxConnections)
|
||||
ht.ServicePoint.ConnectionLimit = maxConnections;
|
||||
|
||||
|
@ -969,7 +982,7 @@ namespace OpenSim.Framework
|
|||
///
|
||||
/// <exception cref="System.Net.WebException">Thrown if we encounter a network issue while posting
|
||||
/// the request. You'll want to make sure you deal with this as they're not uncommon</exception>
|
||||
public static string MakeRequest(string verb, string requestUrl, string obj, int timeoutsecs)
|
||||
public static string MakeRequest(string verb, string requestUrl, string obj, int timeoutsecs, IServiceAuth auth)
|
||||
{
|
||||
int reqnum = WebUtil.RequestNumber++;
|
||||
|
||||
|
@ -984,6 +997,10 @@ namespace OpenSim.Framework
|
|||
request.Method = verb;
|
||||
if (timeoutsecs > 0)
|
||||
request.Timeout = timeoutsecs * 1000;
|
||||
|
||||
if (auth != null)
|
||||
auth.AddAuthorization(request.Headers);
|
||||
|
||||
string respstring = String.Empty;
|
||||
|
||||
using (MemoryStream buffer = new MemoryStream())
|
||||
|
@ -1068,10 +1085,20 @@ namespace OpenSim.Framework
|
|||
return respstring;
|
||||
}
|
||||
|
||||
public static string MakeRequest(string verb, string requestUrl, string obj, int timeoutsecs)
|
||||
{
|
||||
return MakeRequest(verb, requestUrl, obj, timeoutsecs, null);
|
||||
}
|
||||
|
||||
public static string MakeRequest(string verb, string requestUrl, string obj)
|
||||
{
|
||||
return MakeRequest(verb, requestUrl, obj, -1);
|
||||
}
|
||||
|
||||
public static string MakeRequest(string verb, string requestUrl, string obj, IServiceAuth auth)
|
||||
{
|
||||
return MakeRequest(verb, requestUrl, obj, -1, auth);
|
||||
}
|
||||
}
|
||||
|
||||
public class SynchronousRestObjectRequester
|
||||
|
@ -1094,6 +1121,10 @@ namespace OpenSim.Framework
|
|||
return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, 0);
|
||||
}
|
||||
|
||||
public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, IServiceAuth auth)
|
||||
{
|
||||
return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, 0, auth);
|
||||
}
|
||||
/// <summary>
|
||||
/// Perform a synchronous REST request.
|
||||
/// </summary>
|
||||
|
@ -1112,7 +1143,11 @@ namespace OpenSim.Framework
|
|||
return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, pTimeout, 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout, IServiceAuth auth)
|
||||
{
|
||||
return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, pTimeout, 0, auth);
|
||||
}
|
||||
|
||||
/// Perform a synchronous REST request.
|
||||
/// </summary>
|
||||
/// <param name="verb"></param>
|
||||
|
@ -1127,6 +1162,25 @@ namespace OpenSim.Framework
|
|||
/// then the default(TResponse) is returned.
|
||||
/// </returns>
|
||||
public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout, int maxConnections)
|
||||
{
|
||||
return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, pTimeout, maxConnections, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Perform a synchronous REST request.
|
||||
/// </summary>
|
||||
/// <param name="verb"></param>
|
||||
/// <param name="requestUrl"></param>
|
||||
/// <param name="obj"></param>
|
||||
/// <param name="pTimeout">
|
||||
/// Request timeout in milliseconds. Timeout.Infinite indicates no timeout. If 0 is passed then the default HttpWebRequest timeout is used (100 seconds)
|
||||
/// </param>
|
||||
/// <param name="maxConnections"></param>
|
||||
/// <returns>
|
||||
/// The response. If there was an internal exception or the request timed out,
|
||||
/// then the default(TResponse) is returned.
|
||||
/// </returns>
|
||||
public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout, int maxConnections, IServiceAuth auth)
|
||||
{
|
||||
int reqnum = WebUtil.RequestNumber++;
|
||||
|
||||
|
@ -1143,6 +1197,9 @@ namespace OpenSim.Framework
|
|||
WebRequest request = WebRequest.Create(requestUrl);
|
||||
HttpWebRequest ht = (HttpWebRequest)request;
|
||||
|
||||
if (auth != null)
|
||||
auth.AddAuthorization(ht.Headers);
|
||||
|
||||
if (pTimeout != 0)
|
||||
ht.Timeout = pTimeout;
|
||||
|
||||
|
@ -1221,8 +1278,18 @@ namespace OpenSim.Framework
|
|||
{
|
||||
using (HttpWebResponse hwr = (HttpWebResponse)e.Response)
|
||||
{
|
||||
if (hwr != null && hwr.StatusCode == HttpStatusCode.NotFound)
|
||||
return deserial;
|
||||
if (hwr != null)
|
||||
{
|
||||
if (hwr.StatusCode == HttpStatusCode.NotFound)
|
||||
return deserial;
|
||||
if (hwr.StatusCode == HttpStatusCode.Unauthorized)
|
||||
{
|
||||
m_log.Error(string.Format(
|
||||
"[SynchronousRestObjectRequester]: Web request {0} requires authentication ",
|
||||
requestUrl));
|
||||
return deserial;
|
||||
}
|
||||
}
|
||||
else
|
||||
m_log.Error(string.Format(
|
||||
"[SynchronousRestObjectRequester]: WebException for {0} {1} {2} ",
|
||||
|
|
|
@ -37,6 +37,7 @@ using System.Collections.Generic;
|
|||
using System.Reflection;
|
||||
using log4net;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
@ -54,7 +55,7 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
|
|||
private string m_URL = String.Empty;
|
||||
private static XmlSerializer m_serializer = new XmlSerializer(typeof(AssetBase));
|
||||
|
||||
|
||||
private static IServiceAuth m_Auth;
|
||||
|
||||
public void Initialise(IConfigSource configSource)
|
||||
{
|
||||
|
@ -63,6 +64,7 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
|
|||
return;
|
||||
|
||||
m_URL = config.GetString("URL", String.Empty);
|
||||
m_Auth = ServiceAuth.Create(configSource, "XBakes");
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
|
@ -110,7 +112,7 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
|
|||
|
||||
try
|
||||
{
|
||||
Stream s = rc.Request();
|
||||
Stream s = rc.Request(m_Auth);
|
||||
XmlTextReader sr = new XmlTextReader(s);
|
||||
|
||||
sr.ReadStartElement("BakedAppearance");
|
||||
|
@ -183,7 +185,7 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
|
|||
Util.FireAndForget(
|
||||
delegate
|
||||
{
|
||||
rc.Request(reqStream);
|
||||
rc.Request(reqStream, m_Auth);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -381,7 +381,7 @@ namespace OpenSim.Region.DataSnapshot
|
|||
cli.RequestMethod = "GET";
|
||||
try
|
||||
{
|
||||
reply = cli.Request();
|
||||
reply = cli.Request(null);
|
||||
}
|
||||
catch (WebException)
|
||||
{
|
||||
|
|
|
@ -30,6 +30,7 @@ using System.IO;
|
|||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
@ -83,9 +84,11 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
allowedRemoteDeleteTypes = AllowedRemoteDeleteTypes.MapTile;
|
||||
}
|
||||
|
||||
server.AddStreamHandler(new AssetServerGetHandler(m_AssetService));
|
||||
server.AddStreamHandler(new AssetServerPostHandler(m_AssetService));
|
||||
server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService, allowedRemoteDeleteTypes));
|
||||
IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
|
||||
|
||||
server.AddStreamHandler(new AssetServerGetHandler(m_AssetService, auth));
|
||||
server.AddStreamHandler(new AssetServerPostHandler(m_AssetService, auth));
|
||||
server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService, allowedRemoteDeleteTypes, auth));
|
||||
server.AddStreamHandler(new AssetsExistHandler(m_AssetService));
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("Assets", false,
|
||||
|
|
|
@ -38,6 +38,7 @@ using System.Xml.Serialization;
|
|||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
|
||||
namespace OpenSim.Server.Handlers.Asset
|
||||
|
@ -70,6 +71,12 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
m_allowedTypes = allowedTypes;
|
||||
}
|
||||
|
||||
public AssetServerDeleteHandler(IAssetService service, AllowedRemoteDeleteTypes allowedTypes, IServiceAuth auth) :
|
||||
base("DELETE", "/assets", auth)
|
||||
{
|
||||
m_AssetService = service;
|
||||
m_allowedTypes = allowedTypes;
|
||||
}
|
||||
protected override byte[] ProcessRequest(string path, Stream request,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
|
|
|
@ -38,13 +38,14 @@ using System.Xml.Serialization;
|
|||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
|
||||
namespace OpenSim.Server.Handlers.Asset
|
||||
{
|
||||
public class AssetServerGetHandler : BaseStreamHandler
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private IAssetService m_AssetService;
|
||||
|
||||
|
@ -54,6 +55,12 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
m_AssetService = service;
|
||||
}
|
||||
|
||||
public AssetServerGetHandler(IAssetService service, IServiceAuth auth) :
|
||||
base("GET", "/assets", auth)
|
||||
{
|
||||
m_AssetService = service;
|
||||
}
|
||||
|
||||
protected override byte[] ProcessRequest(string path, Stream request,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
|
|
|
@ -38,6 +38,7 @@ using System.Xml.Serialization;
|
|||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
|
||||
namespace OpenSim.Server.Handlers.Asset
|
||||
|
@ -54,6 +55,12 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
m_AssetService = service;
|
||||
}
|
||||
|
||||
public AssetServerPostHandler(IAssetService service, IServiceAuth auth) :
|
||||
base("POST", "/assets", auth)
|
||||
{
|
||||
m_AssetService = service;
|
||||
}
|
||||
|
||||
protected override byte[] ProcessRequest(string path, Stream request,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
|
|
|
@ -38,6 +38,7 @@ using System.Xml.Serialization;
|
|||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenMetaverse;
|
||||
|
||||
|
@ -55,6 +56,12 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
m_AssetService = service;
|
||||
}
|
||||
|
||||
public AssetsExistHandler(IAssetService service, IServiceAuth auth) :
|
||||
base("POST", "/get_assets_exist", auth)
|
||||
{
|
||||
m_AssetService = service;
|
||||
}
|
||||
|
||||
protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
XmlSerializer xs;
|
||||
|
|
|
@ -29,6 +29,7 @@ using System;
|
|||
using Nini.Config;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
|
||||
|
@ -58,7 +59,9 @@ namespace OpenSim.Server.Handlers.Authentication
|
|||
Object[] args = new Object[] { config };
|
||||
m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authenticationService, args);
|
||||
|
||||
server.AddStreamHandler(new AuthenticationServerPostHandler(m_AuthenticationService, serverConfig));
|
||||
IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
|
||||
|
||||
server.AddStreamHandler(new AuthenticationServerPostHandler(m_AuthenticationService, serverConfig, auth));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ using System.Collections.Generic;
|
|||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenMetaverse;
|
||||
|
||||
|
@ -55,10 +56,10 @@ namespace OpenSim.Server.Handlers.Authentication
|
|||
private bool m_AllowSetPassword = false;
|
||||
|
||||
public AuthenticationServerPostHandler(IAuthenticationService service) :
|
||||
this(service, null) {}
|
||||
this(service, null, null) {}
|
||||
|
||||
public AuthenticationServerPostHandler(IAuthenticationService service, IConfig config) :
|
||||
base("POST", "/auth")
|
||||
public AuthenticationServerPostHandler(IAuthenticationService service, IConfig config, IServiceAuth auth) :
|
||||
base("POST", "/auth", auth)
|
||||
{
|
||||
m_AuthenticationService = service;
|
||||
|
||||
|
@ -73,6 +74,7 @@ namespace OpenSim.Server.Handlers.Authentication
|
|||
protected override byte[] ProcessRequest(string path, Stream request,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
m_log.Error("[XXX]: Authenticating...");
|
||||
string[] p = SplitParams(path);
|
||||
|
||||
if (p.Length > 0)
|
||||
|
|
|
@ -29,6 +29,7 @@ using System;
|
|||
using Nini.Config;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
|
||||
|
@ -55,7 +56,9 @@ namespace OpenSim.Server.Handlers.Avatar
|
|||
Object[] args = new Object[] { config };
|
||||
m_AvatarService = ServerUtils.LoadPlugin<IAvatarService>(avatarService, args);
|
||||
|
||||
server.AddStreamHandler(new AvatarServerPostHandler(m_AvatarService));
|
||||
IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
|
||||
|
||||
server.AddStreamHandler(new AvatarServerPostHandler(m_AvatarService, auth));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ using System.Collections.Generic;
|
|||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenMetaverse;
|
||||
|
||||
|
@ -50,8 +51,8 @@ namespace OpenSim.Server.Handlers.Avatar
|
|||
|
||||
private IAvatarService m_AvatarService;
|
||||
|
||||
public AvatarServerPostHandler(IAvatarService service) :
|
||||
base("POST", "/avatar")
|
||||
public AvatarServerPostHandler(IAvatarService service, IServiceAuth auth) :
|
||||
base("POST", "/avatar", auth)
|
||||
{
|
||||
m_AvatarService = service;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ using System.Xml.Serialization;
|
|||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
|
||||
namespace OpenSim.Server.Handlers.BakedTextures
|
||||
|
@ -50,14 +51,14 @@ namespace OpenSim.Server.Handlers.BakedTextures
|
|||
private System.Text.UTF8Encoding utf8 =
|
||||
new System.Text.UTF8Encoding();
|
||||
|
||||
public BakesServerGetHandler(IBakedTextureService service) :
|
||||
base("GET", "/bakes")
|
||||
public BakesServerGetHandler(IBakedTextureService service, IServiceAuth auth) :
|
||||
base("GET", "/bakes", auth)
|
||||
{
|
||||
m_BakesService = service;
|
||||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream request,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
protected override byte[] ProcessRequest(
|
||||
string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
string[] p = SplitParams(path);
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ using System;
|
|||
using Nini.Config;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
|
||||
|
@ -59,8 +60,10 @@ namespace OpenSim.Server.Handlers.BakedTextures
|
|||
m_BakesService =
|
||||
ServerUtils.LoadPlugin<IBakedTextureService>(assetService, args);
|
||||
|
||||
server.AddStreamHandler(new BakesServerGetHandler(m_BakesService));
|
||||
server.AddStreamHandler(new BakesServerPostHandler(m_BakesService));
|
||||
IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
|
||||
|
||||
server.AddStreamHandler(new BakesServerGetHandler(m_BakesService, auth));
|
||||
server.AddStreamHandler(new BakesServerPostHandler(m_BakesService, auth));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,27 +38,28 @@ using System.Xml.Serialization;
|
|||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
|
||||
namespace OpenSim.Server.Handlers.BakedTextures
|
||||
{
|
||||
public class BakesServerPostHandler : BaseStreamHandler
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private IBakedTextureService m_BakesService;
|
||||
|
||||
private System.Text.UTF8Encoding utf8 =
|
||||
new System.Text.UTF8Encoding();
|
||||
|
||||
public BakesServerPostHandler(IBakedTextureService service) :
|
||||
base("POST", "/bakes")
|
||||
public BakesServerPostHandler(IBakedTextureService service, IServiceAuth auth) :
|
||||
base("POST", "/bakes", auth)
|
||||
{
|
||||
m_BakesService = service;
|
||||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream request,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
protected override byte[] ProcessRequest(
|
||||
string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
string[] p = SplitParams(path);
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ using System;
|
|||
using Nini.Config;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
|
||||
|
@ -55,7 +56,8 @@ namespace OpenSim.Server.Handlers.Friends
|
|||
Object[] args = new Object[] { config };
|
||||
m_FriendsService = ServerUtils.LoadPlugin<IFriendsService>(theService, args);
|
||||
|
||||
server.AddStreamHandler(new FriendsServerPostHandler(m_FriendsService));
|
||||
IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
|
||||
server.AddStreamHandler(new FriendsServerPostHandler(m_FriendsService, auth));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ using OpenSim.Server.Base;
|
|||
using OpenSim.Services.Interfaces;
|
||||
using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenMetaverse;
|
||||
|
||||
|
@ -51,8 +52,8 @@ namespace OpenSim.Server.Handlers.Friends
|
|||
|
||||
private IFriendsService m_FriendsService;
|
||||
|
||||
public FriendsServerPostHandler(IFriendsService service) :
|
||||
base("POST", "/friends")
|
||||
public FriendsServerPostHandler(IFriendsService service, IServiceAuth auth) :
|
||||
base("POST", "/friends", auth)
|
||||
{
|
||||
m_FriendsService = service;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ using System;
|
|||
using Nini.Config;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
|
||||
|
@ -55,7 +56,9 @@ namespace OpenSim.Server.Handlers.Grid
|
|||
Object[] args = new Object[] { config };
|
||||
m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
|
||||
|
||||
server.AddStreamHandler(new GridServerPostHandler(m_GridService));
|
||||
IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
|
||||
|
||||
server.AddStreamHandler(new GridServerPostHandler(m_GridService, auth));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ using OpenSim.Server.Base;
|
|||
using OpenSim.Services.Interfaces;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenMetaverse;
|
||||
|
||||
|
@ -55,8 +56,8 @@ namespace OpenSim.Server.Handlers.Grid
|
|||
|
||||
private IGridService m_GridService;
|
||||
|
||||
public GridServerPostHandler(IGridService service) :
|
||||
base("POST", "/grid")
|
||||
public GridServerPostHandler(IGridService service, IServiceAuth auth) :
|
||||
base("POST", "/grid", auth)
|
||||
{
|
||||
m_GridService = service;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ using System;
|
|||
using Nini.Config;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
|
||||
|
@ -55,7 +56,9 @@ namespace OpenSim.Server.Handlers.GridUser
|
|||
Object[] args = new Object[] { config };
|
||||
m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(service, args);
|
||||
|
||||
server.AddStreamHandler(new GridUserServerPostHandler(m_GridUserService));
|
||||
IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); ;
|
||||
|
||||
server.AddStreamHandler(new GridUserServerPostHandler(m_GridUserService, auth));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ using System.Collections.Generic;
|
|||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenMetaverse;
|
||||
|
||||
|
@ -50,8 +51,8 @@ namespace OpenSim.Server.Handlers.GridUser
|
|||
|
||||
private IGridUserService m_GridUserService;
|
||||
|
||||
public GridUserServerPostHandler(IGridUserService service) :
|
||||
base("POST", "/griduser")
|
||||
public GridUserServerPostHandler(IGridUserService service, IServiceAuth auth) :
|
||||
base("POST", "/griduser", auth)
|
||||
{
|
||||
m_GridUserService = service;
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
|
@ -71,7 +72,9 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
m_InventoryService =
|
||||
ServerUtils.LoadPlugin<IInventoryService>(inventoryService, args);
|
||||
|
||||
server.AddStreamHandler(new XInventoryConnectorPostHandler(m_InventoryService));
|
||||
IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
|
||||
|
||||
server.AddStreamHandler(new XInventoryConnectorPostHandler(m_InventoryService, auth));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,8 +84,8 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
|
||||
private IInventoryService m_InventoryService;
|
||||
|
||||
public XInventoryConnectorPostHandler(IInventoryService service) :
|
||||
base("POST", "/xinventory")
|
||||
public XInventoryConnectorPostHandler(IInventoryService service, IServiceAuth auth) :
|
||||
base("POST", "/xinventory", auth)
|
||||
{
|
||||
m_InventoryService = service;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ using OpenMetaverse;
|
|||
using OpenSim.Framework;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
|
||||
|
@ -79,7 +80,8 @@ namespace OpenSim.Server.Handlers.MapImage
|
|||
m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is OFF");
|
||||
|
||||
bool proxy = serverConfig.GetBoolean("HasProxy", false);
|
||||
server.AddStreamHandler(new MapServerPostHandler(m_MapService, m_GridService, proxy));
|
||||
IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
|
||||
server.AddStreamHandler(new MapServerPostHandler(m_MapService, m_GridService, proxy, auth));
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -91,8 +93,8 @@ namespace OpenSim.Server.Handlers.MapImage
|
|||
private IGridService m_GridService;
|
||||
bool m_Proxy;
|
||||
|
||||
public MapServerPostHandler(IMapImageService service, IGridService grid, bool proxy) :
|
||||
base("POST", "/map")
|
||||
public MapServerPostHandler(IMapImageService service, IGridService grid, bool proxy, IServiceAuth auth) :
|
||||
base("POST", "/map", auth)
|
||||
{
|
||||
m_MapService = service;
|
||||
m_GridService = grid;
|
||||
|
|
|
@ -30,6 +30,7 @@ using Nini.Config;
|
|||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
|
||||
namespace OpenSim.Server.Handlers.Presence
|
||||
|
@ -55,7 +56,9 @@ namespace OpenSim.Server.Handlers.Presence
|
|||
Object[] args = new Object[] { config };
|
||||
m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(gridService, args);
|
||||
|
||||
server.AddStreamHandler(new PresenceServerPostHandler(m_PresenceService));
|
||||
IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
|
||||
|
||||
server.AddStreamHandler(new PresenceServerPostHandler(m_PresenceService, auth));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ using OpenSim.Server.Base;
|
|||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Server.Handlers.Presence
|
||||
|
@ -50,8 +51,8 @@ namespace OpenSim.Server.Handlers.Presence
|
|||
|
||||
private IPresenceService m_PresenceService;
|
||||
|
||||
public PresenceServerPostHandler(IPresenceService service) :
|
||||
base("POST", "/presence")
|
||||
public PresenceServerPostHandler(IPresenceService service, IServiceAuth auth) :
|
||||
base("POST", "/presence", auth)
|
||||
{
|
||||
m_PresenceService = service;
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ using Nini.Config;
|
|||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
|
||||
namespace OpenSim.Server.Handlers.UserAccounts
|
||||
|
@ -55,7 +56,9 @@ namespace OpenSim.Server.Handlers.UserAccounts
|
|||
Object[] args = new Object[] { config };
|
||||
m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(service, args);
|
||||
|
||||
server.AddStreamHandler(new UserAccountServerPostHandler(m_UserAccountService, serverConfig));
|
||||
IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
|
||||
|
||||
server.AddStreamHandler(new UserAccountServerPostHandler(m_UserAccountService, serverConfig, auth));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ using OpenSim.Services.Interfaces;
|
|||
using OpenSim.Services.UserAccountService;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Server.Handlers.UserAccounts
|
||||
|
@ -54,10 +55,10 @@ namespace OpenSim.Server.Handlers.UserAccounts
|
|||
private bool m_AllowSetAccount = false;
|
||||
|
||||
public UserAccountServerPostHandler(IUserAccountService service)
|
||||
: this(service, null) {}
|
||||
: this(service, null, null) {}
|
||||
|
||||
public UserAccountServerPostHandler(IUserAccountService service, IConfig config) :
|
||||
base("POST", "/accounts")
|
||||
public UserAccountServerPostHandler(IUserAccountService service, IConfig config, IServiceAuth auth) :
|
||||
base("POST", "/accounts", auth)
|
||||
{
|
||||
m_UserAccountService = service;
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ using OpenMetaverse;
|
|||
|
||||
namespace OpenSim.Services.Connectors
|
||||
{
|
||||
public class AssetServicesConnector : IAssetService
|
||||
public class AssetServicesConnector : BaseServiceConnector, IAssetService
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
|
@ -71,6 +71,7 @@ namespace OpenSim.Services.Connectors
|
|||
}
|
||||
|
||||
public AssetServicesConnector(IConfigSource source)
|
||||
: base(source, "AssetService")
|
||||
{
|
||||
Initialise(source);
|
||||
}
|
||||
|
@ -126,7 +127,7 @@ namespace OpenSim.Services.Connectors
|
|||
// = SynchronousRestObjectRequester.MakeRequest<int, AssetBase>(
|
||||
// "GET", uri, 0, m_maxAssetRequestConcurrency);
|
||||
|
||||
asset = SynchronousRestObjectRequester.MakeRequest<int, AssetBase>("GET", uri, 0);
|
||||
asset = SynchronousRestObjectRequester.MakeRequest<int, AssetBase>("GET", uri, 0, m_Auth);
|
||||
|
||||
if (m_Cache != null)
|
||||
m_Cache.Cache(asset);
|
||||
|
@ -156,7 +157,7 @@ namespace OpenSim.Services.Connectors
|
|||
|
||||
string uri = m_ServerURI + "/assets/" + id + "/metadata";
|
||||
|
||||
AssetMetadata asset = SynchronousRestObjectRequester.MakeRequest<int, AssetMetadata>("GET", uri, 0);
|
||||
AssetMetadata asset = SynchronousRestObjectRequester.MakeRequest<int, AssetMetadata>("GET", uri, 0, m_Auth);
|
||||
return asset;
|
||||
}
|
||||
|
||||
|
@ -177,7 +178,7 @@ namespace OpenSim.Services.Connectors
|
|||
|
||||
rc.RequestMethod = "GET";
|
||||
|
||||
Stream s = rc.Request();
|
||||
Stream s = rc.Request(m_Auth);
|
||||
|
||||
if (s == null)
|
||||
return null;
|
||||
|
@ -238,7 +239,7 @@ namespace OpenSim.Services.Connectors
|
|||
m_AssetHandlers.Remove(id);
|
||||
}
|
||||
handlers.Invoke(a);
|
||||
}, m_maxAssetRequestConcurrency);
|
||||
}, m_maxAssetRequestConcurrency, m_Auth);
|
||||
|
||||
success = true;
|
||||
}
|
||||
|
@ -268,7 +269,7 @@ namespace OpenSim.Services.Connectors
|
|||
bool[] exist = null;
|
||||
try
|
||||
{
|
||||
exist = SynchronousRestObjectRequester.MakeRequest<string[], bool[]>("POST", uri, ids);
|
||||
exist = SynchronousRestObjectRequester.MakeRequest<string[], bool[]>("POST", uri, ids, m_Auth);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
@ -297,7 +298,7 @@ namespace OpenSim.Services.Connectors
|
|||
string newID;
|
||||
try
|
||||
{
|
||||
newID = SynchronousRestObjectRequester.MakeRequest<AssetBase, string>("POST", uri, asset);
|
||||
newID = SynchronousRestObjectRequester.MakeRequest<AssetBase, string>("POST", uri, asset, m_Auth);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -343,7 +344,7 @@ namespace OpenSim.Services.Connectors
|
|||
|
||||
string uri = m_ServerURI + "/assets/" + id;
|
||||
|
||||
if (SynchronousRestObjectRequester.MakeRequest<AssetBase, bool>("POST", uri, asset))
|
||||
if (SynchronousRestObjectRequester.MakeRequest<AssetBase, bool>("POST", uri, asset, m_Auth))
|
||||
{
|
||||
if (m_Cache != null)
|
||||
m_Cache.Cache(asset);
|
||||
|
@ -357,7 +358,7 @@ namespace OpenSim.Services.Connectors
|
|||
{
|
||||
string uri = m_ServerURI + "/assets/" + id;
|
||||
|
||||
if (SynchronousRestObjectRequester.MakeRequest<int, bool>("DELETE", uri, 0))
|
||||
if (SynchronousRestObjectRequester.MakeRequest<int, bool>("DELETE", uri, 0, m_Auth))
|
||||
{
|
||||
if (m_Cache != null)
|
||||
m_Cache.Expire(id);
|
||||
|
|
|
@ -32,14 +32,14 @@ using System.IO;
|
|||
using System.Reflection;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Services.Connectors
|
||||
{
|
||||
public class AuthenticationServicesConnector : IAuthenticationService
|
||||
public class AuthenticationServicesConnector : BaseServiceConnector, IAuthenticationService
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
|
@ -57,6 +57,7 @@ namespace OpenSim.Services.Connectors
|
|||
}
|
||||
|
||||
public AuthenticationServicesConnector(IConfigSource source)
|
||||
: base(source, "AuthenticationService")
|
||||
{
|
||||
Initialise(source);
|
||||
}
|
||||
|
@ -79,6 +80,8 @@ namespace OpenSim.Services.Connectors
|
|||
throw new Exception("Authentication connector init error");
|
||||
}
|
||||
m_ServerURI = serviceURI;
|
||||
|
||||
base.Initialise(source, "AuthenticationService");
|
||||
}
|
||||
|
||||
public string Authenticate(UUID principalID, string password, int lifetime)
|
||||
|
@ -92,7 +95,7 @@ namespace OpenSim.Services.Connectors
|
|||
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
m_ServerURI + "/auth/plain",
|
||||
ServerUtils.BuildQueryString(sendData));
|
||||
ServerUtils.BuildQueryString(sendData), m_Auth);
|
||||
|
||||
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(
|
||||
reply);
|
||||
|
@ -105,6 +108,7 @@ namespace OpenSim.Services.Connectors
|
|||
|
||||
public bool Verify(UUID principalID, string token, int lifetime)
|
||||
{
|
||||
m_log.Error("[XXX]: Verify");
|
||||
Dictionary<string, object> sendData = new Dictionary<string, object>();
|
||||
sendData["LIFETIME"] = lifetime.ToString();
|
||||
sendData["PRINCIPAL"] = principalID.ToString();
|
||||
|
@ -114,7 +118,7 @@ namespace OpenSim.Services.Connectors
|
|||
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
m_ServerURI + "/auth/plain",
|
||||
ServerUtils.BuildQueryString(sendData));
|
||||
ServerUtils.BuildQueryString(sendData), m_Auth);
|
||||
|
||||
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(
|
||||
reply);
|
||||
|
@ -135,7 +139,7 @@ namespace OpenSim.Services.Connectors
|
|||
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
m_ServerURI + "/auth/plain",
|
||||
ServerUtils.BuildQueryString(sendData));
|
||||
ServerUtils.BuildQueryString(sendData), m_Auth);
|
||||
|
||||
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(
|
||||
reply);
|
||||
|
|
|
@ -32,7 +32,7 @@ using System.IO;
|
|||
using System.Reflection;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
using IAvatarService = OpenSim.Services.Interfaces.IAvatarService;
|
||||
|
@ -41,7 +41,7 @@ using OpenMetaverse;
|
|||
|
||||
namespace OpenSim.Services.Connectors
|
||||
{
|
||||
public class AvatarServicesConnector : IAvatarService
|
||||
public class AvatarServicesConnector : BaseServiceConnector, IAvatarService
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
|
@ -59,6 +59,7 @@ namespace OpenSim.Services.Connectors
|
|||
}
|
||||
|
||||
public AvatarServicesConnector(IConfigSource source)
|
||||
: base(source, "AvatarService")
|
||||
{
|
||||
Initialise(source);
|
||||
}
|
||||
|
@ -81,6 +82,8 @@ namespace OpenSim.Services.Connectors
|
|||
throw new Exception("Avatar connector init error");
|
||||
}
|
||||
m_ServerURI = serviceURI;
|
||||
|
||||
base.Initialise(source, "AvatarService");
|
||||
}
|
||||
|
||||
|
||||
|
@ -114,7 +117,7 @@ namespace OpenSim.Services.Connectors
|
|||
// m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString);
|
||||
try
|
||||
{
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString);
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
|
||||
if (reply == null || (reply != null && reply == string.Empty))
|
||||
{
|
||||
m_log.DebugFormat("[AVATAR CONNECTOR]: GetAgent received null or empty reply");
|
||||
|
@ -162,7 +165,7 @@ namespace OpenSim.Services.Connectors
|
|||
//m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString);
|
||||
try
|
||||
{
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString);
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
|
||||
if (reply != string.Empty)
|
||||
{
|
||||
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
|
||||
|
@ -207,7 +210,7 @@ namespace OpenSim.Services.Connectors
|
|||
// m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString);
|
||||
try
|
||||
{
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString);
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
|
||||
if (reply != string.Empty)
|
||||
{
|
||||
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
|
||||
|
@ -250,7 +253,7 @@ namespace OpenSim.Services.Connectors
|
|||
// m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString);
|
||||
try
|
||||
{
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString);
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
|
||||
if (reply != string.Empty)
|
||||
{
|
||||
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
|
||||
|
@ -293,7 +296,7 @@ namespace OpenSim.Services.Connectors
|
|||
// m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString);
|
||||
try
|
||||
{
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString);
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
|
||||
if (reply != string.Empty)
|
||||
{
|
||||
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
|
||||
using Nini.Config;
|
||||
|
||||
namespace OpenSim.Services.Connectors
|
||||
{
|
||||
public class BaseServiceConnector
|
||||
{
|
||||
protected IServiceAuth m_Auth;
|
||||
|
||||
public BaseServiceConnector() { }
|
||||
|
||||
public BaseServiceConnector(IConfigSource config, string section)
|
||||
{
|
||||
Initialise(config, section);
|
||||
}
|
||||
|
||||
public void Initialise(IConfigSource config, string section)
|
||||
{
|
||||
string authType = Util.GetConfigVarFromSections<string>(config, "AuthType", new string[] { "Network", section }, "None");
|
||||
|
||||
switch (authType)
|
||||
{
|
||||
case "BasicHttpAuthentication":
|
||||
m_Auth = new BasicHttpAuthentication(config, section);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -32,6 +32,7 @@ using System.IO;
|
|||
using System.Reflection;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
|
||||
|
@ -40,7 +41,7 @@ using OpenMetaverse;
|
|||
|
||||
namespace OpenSim.Services.Connectors.Friends
|
||||
{
|
||||
public class FriendsServicesConnector : IFriendsService
|
||||
public class FriendsServicesConnector : BaseServiceConnector, IFriendsService
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
|
@ -80,6 +81,7 @@ namespace OpenSim.Services.Connectors.Friends
|
|||
throw new Exception("Friends connector init error");
|
||||
}
|
||||
m_ServerURI = serviceURI;
|
||||
base.Initialise(source, "FriendsService");
|
||||
}
|
||||
|
||||
|
||||
|
@ -112,7 +114,7 @@ namespace OpenSim.Services.Connectors.Friends
|
|||
|
||||
try
|
||||
{
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString);
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
|
||||
if (reply != string.Empty)
|
||||
{
|
||||
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
|
||||
|
@ -168,7 +170,7 @@ namespace OpenSim.Services.Connectors.Friends
|
|||
string uri = m_ServerURI + "/friends";
|
||||
try
|
||||
{
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData));
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData), m_Auth);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -223,7 +225,7 @@ namespace OpenSim.Services.Connectors.Friends
|
|||
string uri = m_ServerURI + "/friends";
|
||||
try
|
||||
{
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData));
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData), m_Auth);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
@ -33,6 +33,7 @@ using System.Reflection;
|
|||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
using OpenSim.Server.Base;
|
||||
|
@ -40,7 +41,7 @@ using OpenMetaverse;
|
|||
|
||||
namespace OpenSim.Services.Connectors
|
||||
{
|
||||
public class GridServicesConnector : IGridService
|
||||
public class GridServicesConnector : BaseServiceConnector, IGridService
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
|
@ -80,6 +81,8 @@ namespace OpenSim.Services.Connectors
|
|||
throw new Exception("Grid connector init error");
|
||||
}
|
||||
m_ServerURI = serviceURI;
|
||||
|
||||
base.Initialise(source, "GridService");
|
||||
}
|
||||
|
||||
|
||||
|
@ -102,7 +105,7 @@ namespace OpenSim.Services.Connectors
|
|||
// m_log.DebugFormat("[GRID CONNECTOR]: queryString = {0}", reqString);
|
||||
try
|
||||
{
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString);
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
|
||||
if (reply != string.Empty)
|
||||
{
|
||||
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
|
||||
|
@ -158,7 +161,7 @@ namespace OpenSim.Services.Connectors
|
|||
try
|
||||
{
|
||||
string reply
|
||||
= SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData));
|
||||
= SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData), m_Auth);
|
||||
|
||||
if (reply != string.Empty)
|
||||
{
|
||||
|
@ -195,7 +198,7 @@ namespace OpenSim.Services.Connectors
|
|||
|
||||
try
|
||||
{
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString);
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -238,7 +241,7 @@ namespace OpenSim.Services.Connectors
|
|||
string uri = m_ServerURI + "/grid";
|
||||
try
|
||||
{
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData));
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData), m_Auth);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -285,7 +288,7 @@ namespace OpenSim.Services.Connectors
|
|||
{
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
uri,
|
||||
ServerUtils.BuildQueryString(sendData));
|
||||
ServerUtils.BuildQueryString(sendData), m_Auth);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -330,7 +333,7 @@ namespace OpenSim.Services.Connectors
|
|||
{
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
uri,
|
||||
ServerUtils.BuildQueryString(sendData));
|
||||
ServerUtils.BuildQueryString(sendData), m_Auth);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -374,7 +377,7 @@ namespace OpenSim.Services.Connectors
|
|||
{
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
uri,
|
||||
ServerUtils.BuildQueryString(sendData));
|
||||
ServerUtils.BuildQueryString(sendData), m_Auth);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -428,7 +431,7 @@ namespace OpenSim.Services.Connectors
|
|||
{
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
uri,
|
||||
ServerUtils.BuildQueryString(sendData));
|
||||
ServerUtils.BuildQueryString(sendData), m_Auth);
|
||||
|
||||
//m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply);
|
||||
}
|
||||
|
@ -479,7 +482,7 @@ namespace OpenSim.Services.Connectors
|
|||
{
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
uri,
|
||||
ServerUtils.BuildQueryString(sendData));
|
||||
ServerUtils.BuildQueryString(sendData), m_Auth);
|
||||
|
||||
//m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply);
|
||||
}
|
||||
|
@ -530,7 +533,7 @@ namespace OpenSim.Services.Connectors
|
|||
{
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
uri,
|
||||
ServerUtils.BuildQueryString(sendData));
|
||||
ServerUtils.BuildQueryString(sendData), m_Auth);
|
||||
|
||||
//m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply);
|
||||
}
|
||||
|
@ -583,7 +586,7 @@ namespace OpenSim.Services.Connectors
|
|||
{
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
uri,
|
||||
ServerUtils.BuildQueryString(sendData));
|
||||
ServerUtils.BuildQueryString(sendData), m_Auth);
|
||||
|
||||
//m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply);
|
||||
}
|
||||
|
@ -634,7 +637,7 @@ namespace OpenSim.Services.Connectors
|
|||
{
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
uri,
|
||||
ServerUtils.BuildQueryString(sendData));
|
||||
ServerUtils.BuildQueryString(sendData), m_Auth);
|
||||
|
||||
//m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply);
|
||||
}
|
||||
|
@ -685,7 +688,7 @@ namespace OpenSim.Services.Connectors
|
|||
{
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
uri,
|
||||
ServerUtils.BuildQueryString(sendData));
|
||||
ServerUtils.BuildQueryString(sendData), m_Auth);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
@ -33,6 +33,7 @@ using System.Reflection;
|
|||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
using OpenSim.Server.Base;
|
||||
|
@ -40,7 +41,7 @@ using OpenMetaverse;
|
|||
|
||||
namespace OpenSim.Services.Connectors
|
||||
{
|
||||
public class GridUserServicesConnector : IGridUserService
|
||||
public class GridUserServicesConnector : BaseServiceConnector, IGridUserService
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
|
@ -80,6 +81,7 @@ namespace OpenSim.Services.Connectors
|
|||
throw new Exception("GridUser connector init error");
|
||||
}
|
||||
m_ServerURI = serviceURI;
|
||||
base.Initialise(source, "GridUserService");
|
||||
}
|
||||
|
||||
|
||||
|
@ -162,7 +164,8 @@ namespace OpenSim.Services.Connectors
|
|||
{
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
uri,
|
||||
reqString);
|
||||
reqString,
|
||||
m_Auth);
|
||||
if (reply != string.Empty)
|
||||
{
|
||||
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
|
||||
|
@ -198,7 +201,8 @@ namespace OpenSim.Services.Connectors
|
|||
{
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
uri,
|
||||
reqString);
|
||||
reqString,
|
||||
m_Auth);
|
||||
if (reply != string.Empty)
|
||||
{
|
||||
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
|
||||
|
@ -243,7 +247,8 @@ namespace OpenSim.Services.Connectors
|
|||
{
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
uri,
|
||||
reqString);
|
||||
reqString,
|
||||
m_Auth);
|
||||
if (reply == null || (reply != null && reply == string.Empty))
|
||||
{
|
||||
m_log.DebugFormat("[GRID USER CONNECTOR]: GetGridUserInfo received null or empty reply");
|
||||
|
|
|
@ -40,7 +40,7 @@ using OpenMetaverse;
|
|||
|
||||
namespace OpenSim.Services.Connectors
|
||||
{
|
||||
public class XInventoryServicesConnector : IInventoryService
|
||||
public class XInventoryServicesConnector : BaseServiceConnector, IInventoryService
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
|
@ -60,6 +60,7 @@ namespace OpenSim.Services.Connectors
|
|||
}
|
||||
|
||||
public XInventoryServicesConnector(IConfigSource source)
|
||||
: base(source, "InventoryService")
|
||||
{
|
||||
Initialise(source);
|
||||
}
|
||||
|
@ -505,7 +506,7 @@ namespace OpenSim.Services.Connectors
|
|||
lock (m_Lock)
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
m_ServerURI + "/xinventory",
|
||||
ServerUtils.BuildQueryString(sendData));
|
||||
ServerUtils.BuildQueryString(sendData), m_Auth);
|
||||
|
||||
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(
|
||||
reply);
|
||||
|
|
|
@ -36,6 +36,7 @@ using Nini.Config;
|
|||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenMetaverse;
|
||||
|
@ -43,7 +44,7 @@ using OpenMetaverse.StructuredData;
|
|||
|
||||
namespace OpenSim.Services.Connectors
|
||||
{
|
||||
public class MapImageServicesConnector : IMapImageService
|
||||
public class MapImageServicesConnector : BaseServiceConnector, IMapImageService
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
|
@ -84,6 +85,7 @@ namespace OpenSim.Services.Connectors
|
|||
}
|
||||
m_ServerURI = serviceURI;
|
||||
m_ServerURI = serviceURI.TrimEnd('/');
|
||||
base.Initialise(source, "MapImageService");
|
||||
}
|
||||
|
||||
public bool RemoveMapTile(int x, int y, out string reason)
|
||||
|
@ -101,7 +103,8 @@ namespace OpenSim.Services.Connectors
|
|||
{
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
uri,
|
||||
reqString);
|
||||
reqString,
|
||||
m_Auth);
|
||||
if (reply != string.Empty)
|
||||
{
|
||||
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
|
||||
|
@ -163,7 +166,8 @@ namespace OpenSim.Services.Connectors
|
|||
{
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
uri,
|
||||
reqString);
|
||||
reqString,
|
||||
m_Auth);
|
||||
if (reply != string.Empty)
|
||||
{
|
||||
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
|
||||
|
|
|
@ -33,6 +33,7 @@ using System.Reflection;
|
|||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
using OpenSim.Server.Base;
|
||||
|
@ -40,7 +41,7 @@ using OpenMetaverse;
|
|||
|
||||
namespace OpenSim.Services.Connectors
|
||||
{
|
||||
public class PresenceServicesConnector : IPresenceService
|
||||
public class PresenceServicesConnector : BaseServiceConnector, IPresenceService
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
|
@ -80,6 +81,8 @@ namespace OpenSim.Services.Connectors
|
|||
throw new Exception("Presence connector init error");
|
||||
}
|
||||
m_ServerURI = serviceURI;
|
||||
|
||||
base.Initialise(source, "PresenceService");
|
||||
}
|
||||
|
||||
|
||||
|
@ -104,7 +107,8 @@ namespace OpenSim.Services.Connectors
|
|||
{
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
uri,
|
||||
reqString);
|
||||
reqString,
|
||||
m_Auth);
|
||||
if (reply != string.Empty)
|
||||
{
|
||||
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
|
||||
|
@ -149,7 +153,8 @@ namespace OpenSim.Services.Connectors
|
|||
{
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
uri,
|
||||
reqString);
|
||||
reqString,
|
||||
m_Auth);
|
||||
if (reply != string.Empty)
|
||||
{
|
||||
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
|
||||
|
@ -193,7 +198,8 @@ namespace OpenSim.Services.Connectors
|
|||
{
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
uri,
|
||||
reqString);
|
||||
reqString,
|
||||
m_Auth);
|
||||
if (reply != string.Empty)
|
||||
{
|
||||
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
|
||||
|
@ -238,7 +244,8 @@ namespace OpenSim.Services.Connectors
|
|||
{
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
uri,
|
||||
reqString);
|
||||
reqString,
|
||||
m_Auth);
|
||||
if (reply != string.Empty)
|
||||
{
|
||||
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
|
||||
|
@ -283,7 +290,8 @@ namespace OpenSim.Services.Connectors
|
|||
{
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
uri,
|
||||
reqString);
|
||||
reqString,
|
||||
m_Auth);
|
||||
if (reply == null || (reply != null && reply == string.Empty))
|
||||
{
|
||||
m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgent received null or empty reply");
|
||||
|
@ -327,7 +335,8 @@ namespace OpenSim.Services.Connectors
|
|||
{
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
uri,
|
||||
reqString);
|
||||
reqString,
|
||||
m_Auth);
|
||||
if (reply == null || (reply != null && reply == string.Empty))
|
||||
{
|
||||
m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgents received null or empty reply");
|
||||
|
|
|
@ -33,13 +33,14 @@ using System.Reflection;
|
|||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Services.Connectors
|
||||
{
|
||||
public class UserAccountServicesConnector : IUserAccountService
|
||||
public class UserAccountServicesConnector : BaseServiceConnector, IUserAccountService
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
|
@ -79,6 +80,8 @@ namespace OpenSim.Services.Connectors
|
|||
throw new Exception("User account connector init error");
|
||||
}
|
||||
m_ServerURI = serviceURI;
|
||||
|
||||
base.Initialise(source, "UserAccountService");
|
||||
}
|
||||
|
||||
public virtual UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName)
|
||||
|
@ -144,7 +147,8 @@ namespace OpenSim.Services.Connectors
|
|||
{
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
uri,
|
||||
reqString);
|
||||
reqString,
|
||||
m_Auth);
|
||||
if (reply == null || (reply != null && reply == string.Empty))
|
||||
{
|
||||
m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetUserAccounts received null or empty reply");
|
||||
|
@ -224,7 +228,8 @@ namespace OpenSim.Services.Connectors
|
|||
{
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
uri,
|
||||
reqString);
|
||||
reqString,
|
||||
m_Auth);
|
||||
if (reply == null || (reply != null && reply == string.Empty))
|
||||
{
|
||||
m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetUserAccount received null or empty reply");
|
||||
|
@ -260,7 +265,8 @@ namespace OpenSim.Services.Connectors
|
|||
{
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
uri,
|
||||
reqString);
|
||||
reqString,
|
||||
m_Auth);
|
||||
if (reply != string.Empty)
|
||||
{
|
||||
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
|
||||
|
|
|
@ -470,6 +470,16 @@
|
|||
;; web server
|
||||
; user_agent = "OpenSim LSL (Mozilla Compatible)"
|
||||
|
||||
;; The follow 3 variables are for HTTP Basic Authentication for the Robust services.
|
||||
;; Use this if your central services in port 8003 need to be accessible on the Internet
|
||||
;; but you want to protect them from unauthorized access. The username and password
|
||||
;; here need to match the ones in the Robust service configuration.
|
||||
; AuthType = "BasicHttpAuthentication"
|
||||
; HttpAuthUsername = "some_username"
|
||||
; HttpAuthPassword = "some_password"
|
||||
;;
|
||||
;; Any of these 3 variables above can be overriden in any of the service sections.
|
||||
|
||||
|
||||
[XMLRPC]
|
||||
;# {XmlRpcRouterModule} {} {Module used to route incoming llRemoteData calls} {XmlRpcRouterModule XmlRpcGridRouterModule} XmlRpcRouterModule
|
||||
|
|
|
@ -104,6 +104,21 @@ HGAssetServiceConnector = "HGAssetService@8002/OpenSim.Server.Handlers.dll:Asset
|
|||
; Password for cert
|
||||
; cert_pass = "password"
|
||||
|
||||
;; The follow 3 variables are for HTTP Basic Authentication for the Robust services.
|
||||
;; Use this if your central services in port 8003 need to be accessible on the Internet
|
||||
;; but you want to protect them from unauthorized access.
|
||||
; AuthType = "BasicHttpAuthentication"
|
||||
; HttpAuthUsername = "some_username"
|
||||
; HttpAuthPassword = "some_password"
|
||||
;;
|
||||
;; AuthType above can be overriden in any of the service sections below by
|
||||
; AuthType = "None"
|
||||
;; This is useful in cases where you want to protect most of the services,
|
||||
;; but unprotect individual services. Username and Password can also be
|
||||
;; overriden if you want to use different credentials for the different services.
|
||||
;; Hypgergrid services are not affected by this; they are publicly available
|
||||
;; by design.
|
||||
|
||||
|
||||
; * The following are for the remote console
|
||||
; * They have no effect for the local or basic console types
|
||||
|
|
|
@ -81,6 +81,19 @@ MapGetServiceConnector = "8002/OpenSim.Server.Handlers.dll:MapGetServiceConnecto
|
|||
; Password for cert
|
||||
; cert_pass = "password"
|
||||
|
||||
;; The follow 3 variables are for HTTP Basic Authentication for the Robust services.
|
||||
;; Use this if your central services in port 8003 need to be accessible on the Internet
|
||||
;; but you want to protect them from unauthorized access.
|
||||
; AuthType = "BasicHttpAuthentication"
|
||||
; HttpAuthUsername = "some_username"
|
||||
; HttpAuthPassword = "some_password"
|
||||
;;
|
||||
;; AuthType above can be overriden in any of the service sections below by
|
||||
; AuthType = "None"
|
||||
;; This is useful in cases where you want to protect most of the services,
|
||||
;; but unprotect individual services. Username and Password can also be
|
||||
;; overriden if you want to use different credentials for the different services.
|
||||
|
||||
|
||||
; * The following are for the remote console
|
||||
; * They have no effect for the local or basic console types
|
||||
|
|
|
@ -111,6 +111,7 @@
|
|||
<Files>
|
||||
<Match pattern="*.cs" recurse="false"/>
|
||||
<Match path="Client" pattern="*.cs" recurse="true"/>
|
||||
<Match path="ServiceAuth" pattern="*.cs" recurse="true"/>
|
||||
</Files>
|
||||
</Project>
|
||||
|
||||
|
|
Loading…
Reference in New Issue