Adds optional HTTP Basic Authentication to Robust service connectors.

bullet-2.82
Diva Canto 2014-05-23 16:19:43 -07:00
parent b7c7293c7a
commit 20f20895cf
47 changed files with 519 additions and 116 deletions

View File

@ -35,6 +35,8 @@ using System.Threading;
using System.Web; using System.Web;
using log4net; using log4net;
using OpenSim.Framework.ServiceAuth;
namespace OpenSim.Framework.Communications namespace OpenSim.Framework.Communications
{ {
/// <summary> /// <summary>
@ -297,7 +299,7 @@ namespace OpenSim.Framework.Communications
/// <summary> /// <summary>
/// Perform a synchronous request /// Perform a synchronous request
/// </summary> /// </summary>
public Stream Request() public Stream Request(IServiceAuth auth)
{ {
lock (_lock) lock (_lock)
{ {
@ -307,6 +309,8 @@ namespace OpenSim.Framework.Communications
_request.Timeout = 200000; _request.Timeout = 200000;
_request.Method = RequestMethod; _request.Method = RequestMethod;
_asyncException = null; _asyncException = null;
if (auth != null)
auth.AddAuthorization(_request.Headers);
// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request); // IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request);
try 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 = (HttpWebRequest) WebRequest.Create(buildUri());
_request.KeepAlive = false; _request.KeepAlive = false;
@ -367,6 +371,8 @@ namespace OpenSim.Framework.Communications
_request.Method = RequestMethod; _request.Method = RequestMethod;
_asyncException = null; _asyncException = null;
_request.ContentLength = src.Length; _request.ContentLength = src.Length;
if (auth != null)
auth.AddAuthorization(_request.Headers);
m_log.InfoFormat("[REST]: Request Length {0}", _request.ContentLength); m_log.InfoFormat("[REST]: Request Length {0}", _request.ContentLength);
m_log.InfoFormat("[REST]: Sending Web Request {0}", buildUri()); m_log.InfoFormat("[REST]: Sending Web Request {0}", buildUri());
@ -384,7 +390,22 @@ namespace OpenSim.Framework.Communications
length = src.Read(buf, 0, 1024); 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); // IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request);
@ -423,7 +444,7 @@ namespace OpenSim.Framework.Communications
try try
{ {
// Perform the operation; if sucessful set the result // Perform the operation; if sucessful set the result
Stream s = Request(); Stream s = Request(null);
ar.SetAsCompleted(s, false); ar.SetAsCompleted(s, false);
} }
catch (Exception e) catch (Exception e)

View File

@ -26,6 +26,8 @@
*/ */
using System.IO; using System.IO;
using System.Net;
using OpenSim.Framework.ServiceAuth;
namespace OpenSim.Framework.Servers.HttpServer namespace OpenSim.Framework.Servers.HttpServer
{ {
@ -37,15 +39,30 @@ namespace OpenSim.Framework.Servers.HttpServer
/// </remarks> /// </remarks>
public abstract class BaseStreamHandler : BaseRequestHandler, IStreamedRequestHandler 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) protected BaseStreamHandler(string httpMethod, string path, string name, string description)
: base(httpMethod, path, name, 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( public virtual byte[] Handle(
string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{ {
RequestsReceived++; 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); byte[] result = ProcessRequest(path, request, httpRequest, httpResponse);

View File

@ -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;
}
}
}

View File

@ -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);
}
}

View File

@ -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;
}
}
}

View File

@ -45,6 +45,8 @@ using Nwc.XmlRpc;
using OpenMetaverse.StructuredData; using OpenMetaverse.StructuredData;
using XMLResponseHelper = OpenSim.Framework.SynchronousRestObjectRequester.XMLResponseHelper; using XMLResponseHelper = OpenSim.Framework.SynchronousRestObjectRequester.XMLResponseHelper;
using OpenSim.Framework.ServiceAuth;
namespace OpenSim.Framework namespace OpenSim.Framework
{ {
/// <summary> /// <summary>
@ -772,6 +774,13 @@ namespace OpenSim.Framework
public static void MakeRequest<TRequest, TResponse>(string verb, public static void MakeRequest<TRequest, TResponse>(string verb,
string requestUrl, TRequest obj, Action<TResponse> action, string requestUrl, TRequest obj, Action<TResponse> action,
int maxConnections) 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++; int reqnum = WebUtil.RequestNumber++;
@ -786,6 +795,10 @@ namespace OpenSim.Framework
WebRequest request = WebRequest.Create(requestUrl); WebRequest request = WebRequest.Create(requestUrl);
HttpWebRequest ht = (HttpWebRequest)request; HttpWebRequest ht = (HttpWebRequest)request;
if (auth != null)
auth.AddAuthorization(ht.Headers);
if (maxConnections > 0 && ht.ServicePoint.ConnectionLimit < maxConnections) if (maxConnections > 0 && ht.ServicePoint.ConnectionLimit < maxConnections)
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 /// <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> /// 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++; int reqnum = WebUtil.RequestNumber++;
@ -984,6 +997,10 @@ namespace OpenSim.Framework
request.Method = verb; request.Method = verb;
if (timeoutsecs > 0) if (timeoutsecs > 0)
request.Timeout = timeoutsecs * 1000; request.Timeout = timeoutsecs * 1000;
if (auth != null)
auth.AddAuthorization(request.Headers);
string respstring = String.Empty; string respstring = String.Empty;
using (MemoryStream buffer = new MemoryStream()) using (MemoryStream buffer = new MemoryStream())
@ -1068,10 +1085,20 @@ namespace OpenSim.Framework
return respstring; 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) public static string MakeRequest(string verb, string requestUrl, string obj)
{ {
return MakeRequest(verb, requestUrl, obj, -1); 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 public class SynchronousRestObjectRequester
@ -1094,6 +1121,10 @@ namespace OpenSim.Framework
return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, 0); 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> /// <summary>
/// Perform a synchronous REST request. /// Perform a synchronous REST request.
/// </summary> /// </summary>
@ -1112,7 +1143,11 @@ namespace OpenSim.Framework
return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, pTimeout, 0); 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. /// Perform a synchronous REST request.
/// </summary> /// </summary>
/// <param name="verb"></param> /// <param name="verb"></param>
@ -1127,6 +1162,25 @@ namespace OpenSim.Framework
/// then the default(TResponse) is returned. /// then the default(TResponse) is returned.
/// </returns> /// </returns>
public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout, int maxConnections) 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++; int reqnum = WebUtil.RequestNumber++;
@ -1143,6 +1197,9 @@ namespace OpenSim.Framework
WebRequest request = WebRequest.Create(requestUrl); WebRequest request = WebRequest.Create(requestUrl);
HttpWebRequest ht = (HttpWebRequest)request; HttpWebRequest ht = (HttpWebRequest)request;
if (auth != null)
auth.AddAuthorization(ht.Headers);
if (pTimeout != 0) if (pTimeout != 0)
ht.Timeout = pTimeout; ht.Timeout = pTimeout;
@ -1221,8 +1278,18 @@ namespace OpenSim.Framework
{ {
using (HttpWebResponse hwr = (HttpWebResponse)e.Response) using (HttpWebResponse hwr = (HttpWebResponse)e.Response)
{ {
if (hwr != null && hwr.StatusCode == HttpStatusCode.NotFound) if (hwr != null)
return deserial; {
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 else
m_log.Error(string.Format( m_log.Error(string.Format(
"[SynchronousRestObjectRequester]: WebException for {0} {1} {2} ", "[SynchronousRestObjectRequester]: WebException for {0} {1} {2} ",

View File

@ -37,6 +37,7 @@ using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using log4net; using log4net;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.ServiceAuth;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
@ -54,7 +55,7 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
private string m_URL = String.Empty; private string m_URL = String.Empty;
private static XmlSerializer m_serializer = new XmlSerializer(typeof(AssetBase)); private static XmlSerializer m_serializer = new XmlSerializer(typeof(AssetBase));
private static IServiceAuth m_Auth;
public void Initialise(IConfigSource configSource) public void Initialise(IConfigSource configSource)
{ {
@ -63,6 +64,7 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
return; return;
m_URL = config.GetString("URL", String.Empty); m_URL = config.GetString("URL", String.Empty);
m_Auth = ServiceAuth.Create(configSource, "XBakes");
} }
public void AddRegion(Scene scene) public void AddRegion(Scene scene)
@ -110,7 +112,7 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
try try
{ {
Stream s = rc.Request(); Stream s = rc.Request(m_Auth);
XmlTextReader sr = new XmlTextReader(s); XmlTextReader sr = new XmlTextReader(s);
sr.ReadStartElement("BakedAppearance"); sr.ReadStartElement("BakedAppearance");
@ -183,7 +185,7 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
Util.FireAndForget( Util.FireAndForget(
delegate delegate
{ {
rc.Request(reqStream); rc.Request(reqStream, m_Auth);
} }
); );
} }

View File

@ -381,7 +381,7 @@ namespace OpenSim.Region.DataSnapshot
cli.RequestMethod = "GET"; cli.RequestMethod = "GET";
try try
{ {
reply = cli.Request(); reply = cli.Request(null);
} }
catch (WebException) catch (WebException)
{ {

View File

@ -30,6 +30,7 @@ using System.IO;
using Nini.Config; using Nini.Config;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.ServiceAuth;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Server.Base; using OpenSim.Server.Base;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
@ -83,9 +84,11 @@ namespace OpenSim.Server.Handlers.Asset
allowedRemoteDeleteTypes = AllowedRemoteDeleteTypes.MapTile; allowedRemoteDeleteTypes = AllowedRemoteDeleteTypes.MapTile;
} }
server.AddStreamHandler(new AssetServerGetHandler(m_AssetService)); IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
server.AddStreamHandler(new AssetServerPostHandler(m_AssetService));
server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService, allowedRemoteDeleteTypes)); 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)); server.AddStreamHandler(new AssetsExistHandler(m_AssetService));
MainConsole.Instance.Commands.AddCommand("Assets", false, MainConsole.Instance.Commands.AddCommand("Assets", false,

View File

@ -38,6 +38,7 @@ using System.Xml.Serialization;
using OpenSim.Server.Base; using OpenSim.Server.Base;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.ServiceAuth;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
namespace OpenSim.Server.Handlers.Asset namespace OpenSim.Server.Handlers.Asset
@ -70,6 +71,12 @@ namespace OpenSim.Server.Handlers.Asset
m_allowedTypes = allowedTypes; 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, protected override byte[] ProcessRequest(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{ {

View File

@ -38,18 +38,25 @@ using System.Xml.Serialization;
using OpenSim.Server.Base; using OpenSim.Server.Base;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.ServiceAuth;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
namespace OpenSim.Server.Handlers.Asset namespace OpenSim.Server.Handlers.Asset
{ {
public class AssetServerGetHandler : BaseStreamHandler 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; private IAssetService m_AssetService;
public AssetServerGetHandler(IAssetService service) : public AssetServerGetHandler(IAssetService service) :
base("GET", "/assets") base("GET", "/assets")
{
m_AssetService = service;
}
public AssetServerGetHandler(IAssetService service, IServiceAuth auth) :
base("GET", "/assets", auth)
{ {
m_AssetService = service; m_AssetService = service;
} }

View File

@ -38,6 +38,7 @@ using System.Xml.Serialization;
using OpenSim.Server.Base; using OpenSim.Server.Base;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.ServiceAuth;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
namespace OpenSim.Server.Handlers.Asset namespace OpenSim.Server.Handlers.Asset
@ -54,6 +55,12 @@ namespace OpenSim.Server.Handlers.Asset
m_AssetService = service; m_AssetService = service;
} }
public AssetServerPostHandler(IAssetService service, IServiceAuth auth) :
base("POST", "/assets", auth)
{
m_AssetService = service;
}
protected override byte[] ProcessRequest(string path, Stream request, protected override byte[] ProcessRequest(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{ {

View File

@ -38,6 +38,7 @@ using System.Xml.Serialization;
using OpenSim.Server.Base; using OpenSim.Server.Base;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.ServiceAuth;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
using OpenMetaverse; using OpenMetaverse;
@ -55,6 +56,12 @@ namespace OpenSim.Server.Handlers.Asset
m_AssetService = service; 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) protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{ {
XmlSerializer xs; XmlSerializer xs;

View File

@ -29,6 +29,7 @@ using System;
using Nini.Config; using Nini.Config;
using OpenSim.Server.Base; using OpenSim.Server.Base;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Framework.ServiceAuth;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Server.Handlers.Base; using OpenSim.Server.Handlers.Base;
@ -58,7 +59,9 @@ namespace OpenSim.Server.Handlers.Authentication
Object[] args = new Object[] { config }; Object[] args = new Object[] { config };
m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authenticationService, args); 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));
} }
} }
} }

View File

@ -39,6 +39,7 @@ using System.Collections.Generic;
using OpenSim.Server.Base; using OpenSim.Server.Base;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.ServiceAuth;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
using OpenMetaverse; using OpenMetaverse;
@ -55,10 +56,10 @@ namespace OpenSim.Server.Handlers.Authentication
private bool m_AllowSetPassword = false; private bool m_AllowSetPassword = false;
public AuthenticationServerPostHandler(IAuthenticationService service) : public AuthenticationServerPostHandler(IAuthenticationService service) :
this(service, null) {} this(service, null, null) {}
public AuthenticationServerPostHandler(IAuthenticationService service, IConfig config) : public AuthenticationServerPostHandler(IAuthenticationService service, IConfig config, IServiceAuth auth) :
base("POST", "/auth") base("POST", "/auth", auth)
{ {
m_AuthenticationService = service; m_AuthenticationService = service;
@ -73,6 +74,7 @@ namespace OpenSim.Server.Handlers.Authentication
protected override byte[] ProcessRequest(string path, Stream request, protected override byte[] ProcessRequest(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{ {
m_log.Error("[XXX]: Authenticating...");
string[] p = SplitParams(path); string[] p = SplitParams(path);
if (p.Length > 0) if (p.Length > 0)

View File

@ -29,6 +29,7 @@ using System;
using Nini.Config; using Nini.Config;
using OpenSim.Server.Base; using OpenSim.Server.Base;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Framework.ServiceAuth;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Server.Handlers.Base; using OpenSim.Server.Handlers.Base;
@ -55,7 +56,9 @@ namespace OpenSim.Server.Handlers.Avatar
Object[] args = new Object[] { config }; Object[] args = new Object[] { config };
m_AvatarService = ServerUtils.LoadPlugin<IAvatarService>(avatarService, args); 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));
} }
} }
} }

View File

@ -39,6 +39,7 @@ using System.Collections.Generic;
using OpenSim.Server.Base; using OpenSim.Server.Base;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.ServiceAuth;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
using OpenMetaverse; using OpenMetaverse;
@ -50,8 +51,8 @@ namespace OpenSim.Server.Handlers.Avatar
private IAvatarService m_AvatarService; private IAvatarService m_AvatarService;
public AvatarServerPostHandler(IAvatarService service) : public AvatarServerPostHandler(IAvatarService service, IServiceAuth auth) :
base("POST", "/avatar") base("POST", "/avatar", auth)
{ {
m_AvatarService = service; m_AvatarService = service;
} }

View File

@ -38,6 +38,7 @@ using System.Xml.Serialization;
using OpenSim.Server.Base; using OpenSim.Server.Base;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.ServiceAuth;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
namespace OpenSim.Server.Handlers.BakedTextures namespace OpenSim.Server.Handlers.BakedTextures
@ -50,14 +51,14 @@ namespace OpenSim.Server.Handlers.BakedTextures
private System.Text.UTF8Encoding utf8 = private System.Text.UTF8Encoding utf8 =
new System.Text.UTF8Encoding(); new System.Text.UTF8Encoding();
public BakesServerGetHandler(IBakedTextureService service) : public BakesServerGetHandler(IBakedTextureService service, IServiceAuth auth) :
base("GET", "/bakes") base("GET", "/bakes", auth)
{ {
m_BakesService = service; m_BakesService = service;
} }
public override byte[] Handle(string path, Stream request, protected override byte[] ProcessRequest(
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{ {
string[] p = SplitParams(path); string[] p = SplitParams(path);

View File

@ -29,6 +29,7 @@ using System;
using Nini.Config; using Nini.Config;
using OpenSim.Server.Base; using OpenSim.Server.Base;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Framework.ServiceAuth;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Server.Handlers.Base; using OpenSim.Server.Handlers.Base;
@ -59,8 +60,10 @@ namespace OpenSim.Server.Handlers.BakedTextures
m_BakesService = m_BakesService =
ServerUtils.LoadPlugin<IBakedTextureService>(assetService, args); ServerUtils.LoadPlugin<IBakedTextureService>(assetService, args);
server.AddStreamHandler(new BakesServerGetHandler(m_BakesService)); IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
server.AddStreamHandler(new BakesServerPostHandler(m_BakesService));
server.AddStreamHandler(new BakesServerGetHandler(m_BakesService, auth));
server.AddStreamHandler(new BakesServerPostHandler(m_BakesService, auth));
} }
} }
} }

View File

@ -38,27 +38,28 @@ using System.Xml.Serialization;
using OpenSim.Server.Base; using OpenSim.Server.Base;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.ServiceAuth;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
namespace OpenSim.Server.Handlers.BakedTextures namespace OpenSim.Server.Handlers.BakedTextures
{ {
public class BakesServerPostHandler : BaseStreamHandler 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 IBakedTextureService m_BakesService;
private System.Text.UTF8Encoding utf8 = private System.Text.UTF8Encoding utf8 =
new System.Text.UTF8Encoding(); new System.Text.UTF8Encoding();
public BakesServerPostHandler(IBakedTextureService service) : public BakesServerPostHandler(IBakedTextureService service, IServiceAuth auth) :
base("POST", "/bakes") base("POST", "/bakes", auth)
{ {
m_BakesService = service; m_BakesService = service;
} }
public override byte[] Handle(string path, Stream request, protected override byte[] ProcessRequest(
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{ {
string[] p = SplitParams(path); string[] p = SplitParams(path);

View File

@ -29,6 +29,7 @@ using System;
using Nini.Config; using Nini.Config;
using OpenSim.Server.Base; using OpenSim.Server.Base;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Framework.ServiceAuth;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Server.Handlers.Base; using OpenSim.Server.Handlers.Base;
@ -55,7 +56,8 @@ namespace OpenSim.Server.Handlers.Friends
Object[] args = new Object[] { config }; Object[] args = new Object[] { config };
m_FriendsService = ServerUtils.LoadPlugin<IFriendsService>(theService, args); 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));
} }
} }
} }

View File

@ -40,6 +40,7 @@ using OpenSim.Server.Base;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.ServiceAuth;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
using OpenMetaverse; using OpenMetaverse;
@ -51,8 +52,8 @@ namespace OpenSim.Server.Handlers.Friends
private IFriendsService m_FriendsService; private IFriendsService m_FriendsService;
public FriendsServerPostHandler(IFriendsService service) : public FriendsServerPostHandler(IFriendsService service, IServiceAuth auth) :
base("POST", "/friends") base("POST", "/friends", auth)
{ {
m_FriendsService = service; m_FriendsService = service;
} }

View File

@ -29,6 +29,7 @@ using System;
using Nini.Config; using Nini.Config;
using OpenSim.Server.Base; using OpenSim.Server.Base;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Framework.ServiceAuth;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Server.Handlers.Base; using OpenSim.Server.Handlers.Base;
@ -55,7 +56,9 @@ namespace OpenSim.Server.Handlers.Grid
Object[] args = new Object[] { config }; Object[] args = new Object[] { config };
m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args); 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));
} }
} }
} }

View File

@ -40,6 +40,7 @@ using OpenSim.Server.Base;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using GridRegion = OpenSim.Services.Interfaces.GridRegion; using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.ServiceAuth;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
using OpenMetaverse; using OpenMetaverse;
@ -55,8 +56,8 @@ namespace OpenSim.Server.Handlers.Grid
private IGridService m_GridService; private IGridService m_GridService;
public GridServerPostHandler(IGridService service) : public GridServerPostHandler(IGridService service, IServiceAuth auth) :
base("POST", "/grid") base("POST", "/grid", auth)
{ {
m_GridService = service; m_GridService = service;
} }

View File

@ -29,6 +29,7 @@ using System;
using Nini.Config; using Nini.Config;
using OpenSim.Server.Base; using OpenSim.Server.Base;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Framework.ServiceAuth;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Server.Handlers.Base; using OpenSim.Server.Handlers.Base;
@ -55,7 +56,9 @@ namespace OpenSim.Server.Handlers.GridUser
Object[] args = new Object[] { config }; Object[] args = new Object[] { config };
m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(service, args); 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));
} }
} }
} }

View File

@ -39,6 +39,7 @@ using System.Collections.Generic;
using OpenSim.Server.Base; using OpenSim.Server.Base;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.ServiceAuth;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
using OpenMetaverse; using OpenMetaverse;
@ -50,8 +51,8 @@ namespace OpenSim.Server.Handlers.GridUser
private IGridUserService m_GridUserService; private IGridUserService m_GridUserService;
public GridUserServerPostHandler(IGridUserService service) : public GridUserServerPostHandler(IGridUserService service, IServiceAuth auth) :
base("POST", "/griduser") base("POST", "/griduser", auth)
{ {
m_GridUserService = service; m_GridUserService = service;
} }

View File

@ -33,6 +33,7 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using Nini.Config; using Nini.Config;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.ServiceAuth;
using OpenSim.Server.Base; using OpenSim.Server.Base;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
@ -71,7 +72,9 @@ namespace OpenSim.Server.Handlers.Asset
m_InventoryService = m_InventoryService =
ServerUtils.LoadPlugin<IInventoryService>(inventoryService, args); 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; private IInventoryService m_InventoryService;
public XInventoryConnectorPostHandler(IInventoryService service) : public XInventoryConnectorPostHandler(IInventoryService service, IServiceAuth auth) :
base("POST", "/xinventory") base("POST", "/xinventory", auth)
{ {
m_InventoryService = service; m_InventoryService = service;
} }

View File

@ -38,6 +38,7 @@ using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Server.Base; using OpenSim.Server.Base;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Framework.ServiceAuth;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Server.Handlers.Base; using OpenSim.Server.Handlers.Base;
@ -79,7 +80,8 @@ namespace OpenSim.Server.Handlers.MapImage
m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is OFF"); m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is OFF");
bool proxy = serverConfig.GetBoolean("HasProxy", false); 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; private IGridService m_GridService;
bool m_Proxy; bool m_Proxy;
public MapServerPostHandler(IMapImageService service, IGridService grid, bool proxy) : public MapServerPostHandler(IMapImageService service, IGridService grid, bool proxy, IServiceAuth auth) :
base("POST", "/map") base("POST", "/map", auth)
{ {
m_MapService = service; m_MapService = service;
m_GridService = grid; m_GridService = grid;

View File

@ -30,6 +30,7 @@ using Nini.Config;
using OpenSim.Server.Base; using OpenSim.Server.Base;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Framework.ServiceAuth;
using OpenSim.Server.Handlers.Base; using OpenSim.Server.Handlers.Base;
namespace OpenSim.Server.Handlers.Presence namespace OpenSim.Server.Handlers.Presence
@ -55,7 +56,9 @@ namespace OpenSim.Server.Handlers.Presence
Object[] args = new Object[] { config }; Object[] args = new Object[] { config };
m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(gridService, args); 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));
} }
} }
} }

View File

@ -40,6 +40,7 @@ using OpenSim.Server.Base;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Framework.ServiceAuth;
using OpenMetaverse; using OpenMetaverse;
namespace OpenSim.Server.Handlers.Presence namespace OpenSim.Server.Handlers.Presence
@ -50,8 +51,8 @@ namespace OpenSim.Server.Handlers.Presence
private IPresenceService m_PresenceService; private IPresenceService m_PresenceService;
public PresenceServerPostHandler(IPresenceService service) : public PresenceServerPostHandler(IPresenceService service, IServiceAuth auth) :
base("POST", "/presence") base("POST", "/presence", auth)
{ {
m_PresenceService = service; m_PresenceService = service;
} }

View File

@ -30,6 +30,7 @@ using Nini.Config;
using OpenSim.Server.Base; using OpenSim.Server.Base;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Framework.ServiceAuth;
using OpenSim.Server.Handlers.Base; using OpenSim.Server.Handlers.Base;
namespace OpenSim.Server.Handlers.UserAccounts namespace OpenSim.Server.Handlers.UserAccounts
@ -55,7 +56,9 @@ namespace OpenSim.Server.Handlers.UserAccounts
Object[] args = new Object[] { config }; Object[] args = new Object[] { config };
m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(service, args); 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));
} }
} }
} }

View File

@ -41,6 +41,7 @@ using OpenSim.Services.Interfaces;
using OpenSim.Services.UserAccountService; using OpenSim.Services.UserAccountService;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Framework.ServiceAuth;
using OpenMetaverse; using OpenMetaverse;
namespace OpenSim.Server.Handlers.UserAccounts namespace OpenSim.Server.Handlers.UserAccounts
@ -54,10 +55,10 @@ namespace OpenSim.Server.Handlers.UserAccounts
private bool m_AllowSetAccount = false; private bool m_AllowSetAccount = false;
public UserAccountServerPostHandler(IUserAccountService service) public UserAccountServerPostHandler(IUserAccountService service)
: this(service, null) {} : this(service, null, null) {}
public UserAccountServerPostHandler(IUserAccountService service, IConfig config) : public UserAccountServerPostHandler(IUserAccountService service, IConfig config, IServiceAuth auth) :
base("POST", "/accounts") base("POST", "/accounts", auth)
{ {
m_UserAccountService = service; m_UserAccountService = service;

View File

@ -39,7 +39,7 @@ using OpenMetaverse;
namespace OpenSim.Services.Connectors namespace OpenSim.Services.Connectors
{ {
public class AssetServicesConnector : IAssetService public class AssetServicesConnector : BaseServiceConnector, IAssetService
{ {
private static readonly ILog m_log = private static readonly ILog m_log =
LogManager.GetLogger( LogManager.GetLogger(
@ -71,6 +71,7 @@ namespace OpenSim.Services.Connectors
} }
public AssetServicesConnector(IConfigSource source) public AssetServicesConnector(IConfigSource source)
: base(source, "AssetService")
{ {
Initialise(source); Initialise(source);
} }
@ -126,7 +127,7 @@ namespace OpenSim.Services.Connectors
// = SynchronousRestObjectRequester.MakeRequest<int, AssetBase>( // = SynchronousRestObjectRequester.MakeRequest<int, AssetBase>(
// "GET", uri, 0, m_maxAssetRequestConcurrency); // "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) if (m_Cache != null)
m_Cache.Cache(asset); m_Cache.Cache(asset);
@ -156,7 +157,7 @@ namespace OpenSim.Services.Connectors
string uri = m_ServerURI + "/assets/" + id + "/metadata"; 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; return asset;
} }
@ -177,7 +178,7 @@ namespace OpenSim.Services.Connectors
rc.RequestMethod = "GET"; rc.RequestMethod = "GET";
Stream s = rc.Request(); Stream s = rc.Request(m_Auth);
if (s == null) if (s == null)
return null; return null;
@ -238,7 +239,7 @@ namespace OpenSim.Services.Connectors
m_AssetHandlers.Remove(id); m_AssetHandlers.Remove(id);
} }
handlers.Invoke(a); handlers.Invoke(a);
}, m_maxAssetRequestConcurrency); }, m_maxAssetRequestConcurrency, m_Auth);
success = true; success = true;
} }
@ -268,7 +269,7 @@ namespace OpenSim.Services.Connectors
bool[] exist = null; bool[] exist = null;
try try
{ {
exist = SynchronousRestObjectRequester.MakeRequest<string[], bool[]>("POST", uri, ids); exist = SynchronousRestObjectRequester.MakeRequest<string[], bool[]>("POST", uri, ids, m_Auth);
} }
catch (Exception) catch (Exception)
{ {
@ -297,7 +298,7 @@ namespace OpenSim.Services.Connectors
string newID; string newID;
try try
{ {
newID = SynchronousRestObjectRequester.MakeRequest<AssetBase, string>("POST", uri, asset); newID = SynchronousRestObjectRequester.MakeRequest<AssetBase, string>("POST", uri, asset, m_Auth);
} }
catch (Exception e) catch (Exception e)
{ {
@ -343,7 +344,7 @@ namespace OpenSim.Services.Connectors
string uri = m_ServerURI + "/assets/" + id; 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) if (m_Cache != null)
m_Cache.Cache(asset); m_Cache.Cache(asset);
@ -357,7 +358,7 @@ namespace OpenSim.Services.Connectors
{ {
string uri = m_ServerURI + "/assets/" + id; 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) if (m_Cache != null)
m_Cache.Expire(id); m_Cache.Expire(id);

View File

@ -32,14 +32,14 @@ using System.IO;
using System.Reflection; using System.Reflection;
using Nini.Config; using Nini.Config;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications; using OpenSim.Framework.ServiceAuth;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Server.Base; using OpenSim.Server.Base;
using OpenMetaverse; using OpenMetaverse;
namespace OpenSim.Services.Connectors namespace OpenSim.Services.Connectors
{ {
public class AuthenticationServicesConnector : IAuthenticationService public class AuthenticationServicesConnector : BaseServiceConnector, IAuthenticationService
{ {
private static readonly ILog m_log = private static readonly ILog m_log =
LogManager.GetLogger( LogManager.GetLogger(
@ -57,6 +57,7 @@ namespace OpenSim.Services.Connectors
} }
public AuthenticationServicesConnector(IConfigSource source) public AuthenticationServicesConnector(IConfigSource source)
: base(source, "AuthenticationService")
{ {
Initialise(source); Initialise(source);
} }
@ -79,6 +80,8 @@ namespace OpenSim.Services.Connectors
throw new Exception("Authentication connector init error"); throw new Exception("Authentication connector init error");
} }
m_ServerURI = serviceURI; m_ServerURI = serviceURI;
base.Initialise(source, "AuthenticationService");
} }
public string Authenticate(UUID principalID, string password, int lifetime) public string Authenticate(UUID principalID, string password, int lifetime)
@ -92,7 +95,7 @@ namespace OpenSim.Services.Connectors
string reply = SynchronousRestFormsRequester.MakeRequest("POST", string reply = SynchronousRestFormsRequester.MakeRequest("POST",
m_ServerURI + "/auth/plain", m_ServerURI + "/auth/plain",
ServerUtils.BuildQueryString(sendData)); ServerUtils.BuildQueryString(sendData), m_Auth);
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(
reply); reply);
@ -105,6 +108,7 @@ namespace OpenSim.Services.Connectors
public bool Verify(UUID principalID, string token, int lifetime) public bool Verify(UUID principalID, string token, int lifetime)
{ {
m_log.Error("[XXX]: Verify");
Dictionary<string, object> sendData = new Dictionary<string, object>(); Dictionary<string, object> sendData = new Dictionary<string, object>();
sendData["LIFETIME"] = lifetime.ToString(); sendData["LIFETIME"] = lifetime.ToString();
sendData["PRINCIPAL"] = principalID.ToString(); sendData["PRINCIPAL"] = principalID.ToString();
@ -114,7 +118,7 @@ namespace OpenSim.Services.Connectors
string reply = SynchronousRestFormsRequester.MakeRequest("POST", string reply = SynchronousRestFormsRequester.MakeRequest("POST",
m_ServerURI + "/auth/plain", m_ServerURI + "/auth/plain",
ServerUtils.BuildQueryString(sendData)); ServerUtils.BuildQueryString(sendData), m_Auth);
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(
reply); reply);
@ -135,7 +139,7 @@ namespace OpenSim.Services.Connectors
string reply = SynchronousRestFormsRequester.MakeRequest("POST", string reply = SynchronousRestFormsRequester.MakeRequest("POST",
m_ServerURI + "/auth/plain", m_ServerURI + "/auth/plain",
ServerUtils.BuildQueryString(sendData)); ServerUtils.BuildQueryString(sendData), m_Auth);
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(
reply); reply);

View File

@ -32,7 +32,7 @@ using System.IO;
using System.Reflection; using System.Reflection;
using Nini.Config; using Nini.Config;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications; using OpenSim.Framework.ServiceAuth;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using GridRegion = OpenSim.Services.Interfaces.GridRegion; using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using IAvatarService = OpenSim.Services.Interfaces.IAvatarService; using IAvatarService = OpenSim.Services.Interfaces.IAvatarService;
@ -41,7 +41,7 @@ using OpenMetaverse;
namespace OpenSim.Services.Connectors namespace OpenSim.Services.Connectors
{ {
public class AvatarServicesConnector : IAvatarService public class AvatarServicesConnector : BaseServiceConnector, IAvatarService
{ {
private static readonly ILog m_log = private static readonly ILog m_log =
LogManager.GetLogger( LogManager.GetLogger(
@ -59,6 +59,7 @@ namespace OpenSim.Services.Connectors
} }
public AvatarServicesConnector(IConfigSource source) public AvatarServicesConnector(IConfigSource source)
: base(source, "AvatarService")
{ {
Initialise(source); Initialise(source);
} }
@ -81,6 +82,8 @@ namespace OpenSim.Services.Connectors
throw new Exception("Avatar connector init error"); throw new Exception("Avatar connector init error");
} }
m_ServerURI = serviceURI; m_ServerURI = serviceURI;
base.Initialise(source, "AvatarService");
} }
@ -114,7 +117,7 @@ namespace OpenSim.Services.Connectors
// m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString);
try try
{ {
reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
if (reply == null || (reply != null && reply == string.Empty)) if (reply == null || (reply != null && reply == string.Empty))
{ {
m_log.DebugFormat("[AVATAR CONNECTOR]: GetAgent received null or empty reply"); 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); //m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString);
try try
{ {
string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
if (reply != string.Empty) if (reply != string.Empty)
{ {
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
@ -207,7 +210,7 @@ namespace OpenSim.Services.Connectors
// m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString);
try try
{ {
string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
if (reply != string.Empty) if (reply != string.Empty)
{ {
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
@ -250,7 +253,7 @@ namespace OpenSim.Services.Connectors
// m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString);
try try
{ {
string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
if (reply != string.Empty) if (reply != string.Empty)
{ {
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
@ -293,7 +296,7 @@ namespace OpenSim.Services.Connectors
// m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString);
try try
{ {
string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
if (reply != string.Empty) if (reply != string.Empty)
{ {
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);

View File

@ -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;
}
}
}
}

View File

@ -32,6 +32,7 @@ using System.IO;
using System.Reflection; using System.Reflection;
using Nini.Config; using Nini.Config;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.ServiceAuth;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
@ -40,7 +41,7 @@ using OpenMetaverse;
namespace OpenSim.Services.Connectors.Friends namespace OpenSim.Services.Connectors.Friends
{ {
public class FriendsServicesConnector : IFriendsService public class FriendsServicesConnector : BaseServiceConnector, IFriendsService
{ {
private static readonly ILog m_log = private static readonly ILog m_log =
LogManager.GetLogger( LogManager.GetLogger(
@ -80,6 +81,7 @@ namespace OpenSim.Services.Connectors.Friends
throw new Exception("Friends connector init error"); throw new Exception("Friends connector init error");
} }
m_ServerURI = serviceURI; m_ServerURI = serviceURI;
base.Initialise(source, "FriendsService");
} }
@ -112,7 +114,7 @@ namespace OpenSim.Services.Connectors.Friends
try try
{ {
string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
if (reply != string.Empty) if (reply != string.Empty)
{ {
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
@ -168,7 +170,7 @@ namespace OpenSim.Services.Connectors.Friends
string uri = m_ServerURI + "/friends"; string uri = m_ServerURI + "/friends";
try try
{ {
reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData)); reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData), m_Auth);
} }
catch (Exception e) catch (Exception e)
{ {
@ -223,7 +225,7 @@ namespace OpenSim.Services.Connectors.Friends
string uri = m_ServerURI + "/friends"; string uri = m_ServerURI + "/friends";
try try
{ {
reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData)); reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData), m_Auth);
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -33,6 +33,7 @@ using System.Reflection;
using Nini.Config; using Nini.Config;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Framework.ServiceAuth;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using GridRegion = OpenSim.Services.Interfaces.GridRegion; using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using OpenSim.Server.Base; using OpenSim.Server.Base;
@ -40,7 +41,7 @@ using OpenMetaverse;
namespace OpenSim.Services.Connectors namespace OpenSim.Services.Connectors
{ {
public class GridServicesConnector : IGridService public class GridServicesConnector : BaseServiceConnector, IGridService
{ {
private static readonly ILog m_log = private static readonly ILog m_log =
LogManager.GetLogger( LogManager.GetLogger(
@ -80,6 +81,8 @@ namespace OpenSim.Services.Connectors
throw new Exception("Grid connector init error"); throw new Exception("Grid connector init error");
} }
m_ServerURI = serviceURI; m_ServerURI = serviceURI;
base.Initialise(source, "GridService");
} }
@ -102,7 +105,7 @@ namespace OpenSim.Services.Connectors
// m_log.DebugFormat("[GRID CONNECTOR]: queryString = {0}", reqString); // m_log.DebugFormat("[GRID CONNECTOR]: queryString = {0}", reqString);
try try
{ {
string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
if (reply != string.Empty) if (reply != string.Empty)
{ {
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
@ -158,7 +161,7 @@ namespace OpenSim.Services.Connectors
try try
{ {
string reply string reply
= SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData)); = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData), m_Auth);
if (reply != string.Empty) if (reply != string.Empty)
{ {
@ -195,7 +198,7 @@ namespace OpenSim.Services.Connectors
try try
{ {
reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
} }
catch (Exception e) catch (Exception e)
{ {
@ -238,7 +241,7 @@ namespace OpenSim.Services.Connectors
string uri = m_ServerURI + "/grid"; string uri = m_ServerURI + "/grid";
try try
{ {
reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData)); reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData), m_Auth);
} }
catch (Exception e) catch (Exception e)
{ {
@ -285,7 +288,7 @@ namespace OpenSim.Services.Connectors
{ {
reply = SynchronousRestFormsRequester.MakeRequest("POST", reply = SynchronousRestFormsRequester.MakeRequest("POST",
uri, uri,
ServerUtils.BuildQueryString(sendData)); ServerUtils.BuildQueryString(sendData), m_Auth);
} }
catch (Exception e) catch (Exception e)
{ {
@ -330,7 +333,7 @@ namespace OpenSim.Services.Connectors
{ {
reply = SynchronousRestFormsRequester.MakeRequest("POST", reply = SynchronousRestFormsRequester.MakeRequest("POST",
uri, uri,
ServerUtils.BuildQueryString(sendData)); ServerUtils.BuildQueryString(sendData), m_Auth);
} }
catch (Exception e) catch (Exception e)
{ {
@ -374,7 +377,7 @@ namespace OpenSim.Services.Connectors
{ {
reply = SynchronousRestFormsRequester.MakeRequest("POST", reply = SynchronousRestFormsRequester.MakeRequest("POST",
uri, uri,
ServerUtils.BuildQueryString(sendData)); ServerUtils.BuildQueryString(sendData), m_Auth);
} }
catch (Exception e) catch (Exception e)
{ {
@ -428,7 +431,7 @@ namespace OpenSim.Services.Connectors
{ {
reply = SynchronousRestFormsRequester.MakeRequest("POST", reply = SynchronousRestFormsRequester.MakeRequest("POST",
uri, uri,
ServerUtils.BuildQueryString(sendData)); ServerUtils.BuildQueryString(sendData), m_Auth);
//m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply);
} }
@ -479,7 +482,7 @@ namespace OpenSim.Services.Connectors
{ {
reply = SynchronousRestFormsRequester.MakeRequest("POST", reply = SynchronousRestFormsRequester.MakeRequest("POST",
uri, uri,
ServerUtils.BuildQueryString(sendData)); ServerUtils.BuildQueryString(sendData), m_Auth);
//m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply);
} }
@ -530,7 +533,7 @@ namespace OpenSim.Services.Connectors
{ {
reply = SynchronousRestFormsRequester.MakeRequest("POST", reply = SynchronousRestFormsRequester.MakeRequest("POST",
uri, uri,
ServerUtils.BuildQueryString(sendData)); ServerUtils.BuildQueryString(sendData), m_Auth);
//m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply);
} }
@ -583,7 +586,7 @@ namespace OpenSim.Services.Connectors
{ {
reply = SynchronousRestFormsRequester.MakeRequest("POST", reply = SynchronousRestFormsRequester.MakeRequest("POST",
uri, uri,
ServerUtils.BuildQueryString(sendData)); ServerUtils.BuildQueryString(sendData), m_Auth);
//m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply);
} }
@ -634,7 +637,7 @@ namespace OpenSim.Services.Connectors
{ {
reply = SynchronousRestFormsRequester.MakeRequest("POST", reply = SynchronousRestFormsRequester.MakeRequest("POST",
uri, uri,
ServerUtils.BuildQueryString(sendData)); ServerUtils.BuildQueryString(sendData), m_Auth);
//m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply);
} }
@ -685,7 +688,7 @@ namespace OpenSim.Services.Connectors
{ {
reply = SynchronousRestFormsRequester.MakeRequest("POST", reply = SynchronousRestFormsRequester.MakeRequest("POST",
uri, uri,
ServerUtils.BuildQueryString(sendData)); ServerUtils.BuildQueryString(sendData), m_Auth);
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -33,6 +33,7 @@ using System.Reflection;
using Nini.Config; using Nini.Config;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Framework.ServiceAuth;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using GridRegion = OpenSim.Services.Interfaces.GridRegion; using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using OpenSim.Server.Base; using OpenSim.Server.Base;
@ -40,7 +41,7 @@ using OpenMetaverse;
namespace OpenSim.Services.Connectors namespace OpenSim.Services.Connectors
{ {
public class GridUserServicesConnector : IGridUserService public class GridUserServicesConnector : BaseServiceConnector, IGridUserService
{ {
private static readonly ILog m_log = private static readonly ILog m_log =
LogManager.GetLogger( LogManager.GetLogger(
@ -80,6 +81,7 @@ namespace OpenSim.Services.Connectors
throw new Exception("GridUser connector init error"); throw new Exception("GridUser connector init error");
} }
m_ServerURI = serviceURI; m_ServerURI = serviceURI;
base.Initialise(source, "GridUserService");
} }
@ -162,7 +164,8 @@ namespace OpenSim.Services.Connectors
{ {
string reply = SynchronousRestFormsRequester.MakeRequest("POST", string reply = SynchronousRestFormsRequester.MakeRequest("POST",
uri, uri,
reqString); reqString,
m_Auth);
if (reply != string.Empty) if (reply != string.Empty)
{ {
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
@ -198,7 +201,8 @@ namespace OpenSim.Services.Connectors
{ {
string reply = SynchronousRestFormsRequester.MakeRequest("POST", string reply = SynchronousRestFormsRequester.MakeRequest("POST",
uri, uri,
reqString); reqString,
m_Auth);
if (reply != string.Empty) if (reply != string.Empty)
{ {
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
@ -243,7 +247,8 @@ namespace OpenSim.Services.Connectors
{ {
reply = SynchronousRestFormsRequester.MakeRequest("POST", reply = SynchronousRestFormsRequester.MakeRequest("POST",
uri, uri,
reqString); reqString,
m_Auth);
if (reply == null || (reply != null && reply == string.Empty)) if (reply == null || (reply != null && reply == string.Empty))
{ {
m_log.DebugFormat("[GRID USER CONNECTOR]: GetGridUserInfo received null or empty reply"); m_log.DebugFormat("[GRID USER CONNECTOR]: GetGridUserInfo received null or empty reply");

View File

@ -40,7 +40,7 @@ using OpenMetaverse;
namespace OpenSim.Services.Connectors namespace OpenSim.Services.Connectors
{ {
public class XInventoryServicesConnector : IInventoryService public class XInventoryServicesConnector : BaseServiceConnector, IInventoryService
{ {
private static readonly ILog m_log = private static readonly ILog m_log =
LogManager.GetLogger( LogManager.GetLogger(
@ -60,6 +60,7 @@ namespace OpenSim.Services.Connectors
} }
public XInventoryServicesConnector(IConfigSource source) public XInventoryServicesConnector(IConfigSource source)
: base(source, "InventoryService")
{ {
Initialise(source); Initialise(source);
} }
@ -505,7 +506,7 @@ namespace OpenSim.Services.Connectors
lock (m_Lock) lock (m_Lock)
reply = SynchronousRestFormsRequester.MakeRequest("POST", reply = SynchronousRestFormsRequester.MakeRequest("POST",
m_ServerURI + "/xinventory", m_ServerURI + "/xinventory",
ServerUtils.BuildQueryString(sendData)); ServerUtils.BuildQueryString(sendData), m_Auth);
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(
reply); reply);

View File

@ -36,6 +36,7 @@ using Nini.Config;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Framework.ServiceAuth;
using OpenSim.Server.Base; using OpenSim.Server.Base;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenMetaverse; using OpenMetaverse;
@ -43,7 +44,7 @@ using OpenMetaverse.StructuredData;
namespace OpenSim.Services.Connectors namespace OpenSim.Services.Connectors
{ {
public class MapImageServicesConnector : IMapImageService public class MapImageServicesConnector : BaseServiceConnector, IMapImageService
{ {
private static readonly ILog m_log = private static readonly ILog m_log =
LogManager.GetLogger( LogManager.GetLogger(
@ -84,6 +85,7 @@ namespace OpenSim.Services.Connectors
} }
m_ServerURI = serviceURI; m_ServerURI = serviceURI;
m_ServerURI = serviceURI.TrimEnd('/'); m_ServerURI = serviceURI.TrimEnd('/');
base.Initialise(source, "MapImageService");
} }
public bool RemoveMapTile(int x, int y, out string reason) public bool RemoveMapTile(int x, int y, out string reason)
@ -101,7 +103,8 @@ namespace OpenSim.Services.Connectors
{ {
string reply = SynchronousRestFormsRequester.MakeRequest("POST", string reply = SynchronousRestFormsRequester.MakeRequest("POST",
uri, uri,
reqString); reqString,
m_Auth);
if (reply != string.Empty) if (reply != string.Empty)
{ {
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
@ -163,7 +166,8 @@ namespace OpenSim.Services.Connectors
{ {
string reply = SynchronousRestFormsRequester.MakeRequest("POST", string reply = SynchronousRestFormsRequester.MakeRequest("POST",
uri, uri,
reqString); reqString,
m_Auth);
if (reply != string.Empty) if (reply != string.Empty)
{ {
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);

View File

@ -33,6 +33,7 @@ using System.Reflection;
using Nini.Config; using Nini.Config;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Framework.ServiceAuth;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using GridRegion = OpenSim.Services.Interfaces.GridRegion; using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using OpenSim.Server.Base; using OpenSim.Server.Base;
@ -40,7 +41,7 @@ using OpenMetaverse;
namespace OpenSim.Services.Connectors namespace OpenSim.Services.Connectors
{ {
public class PresenceServicesConnector : IPresenceService public class PresenceServicesConnector : BaseServiceConnector, IPresenceService
{ {
private static readonly ILog m_log = private static readonly ILog m_log =
LogManager.GetLogger( LogManager.GetLogger(
@ -80,6 +81,8 @@ namespace OpenSim.Services.Connectors
throw new Exception("Presence connector init error"); throw new Exception("Presence connector init error");
} }
m_ServerURI = serviceURI; m_ServerURI = serviceURI;
base.Initialise(source, "PresenceService");
} }
@ -104,7 +107,8 @@ namespace OpenSim.Services.Connectors
{ {
string reply = SynchronousRestFormsRequester.MakeRequest("POST", string reply = SynchronousRestFormsRequester.MakeRequest("POST",
uri, uri,
reqString); reqString,
m_Auth);
if (reply != string.Empty) if (reply != string.Empty)
{ {
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
@ -149,7 +153,8 @@ namespace OpenSim.Services.Connectors
{ {
string reply = SynchronousRestFormsRequester.MakeRequest("POST", string reply = SynchronousRestFormsRequester.MakeRequest("POST",
uri, uri,
reqString); reqString,
m_Auth);
if (reply != string.Empty) if (reply != string.Empty)
{ {
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
@ -193,7 +198,8 @@ namespace OpenSim.Services.Connectors
{ {
string reply = SynchronousRestFormsRequester.MakeRequest("POST", string reply = SynchronousRestFormsRequester.MakeRequest("POST",
uri, uri,
reqString); reqString,
m_Auth);
if (reply != string.Empty) if (reply != string.Empty)
{ {
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
@ -238,7 +244,8 @@ namespace OpenSim.Services.Connectors
{ {
string reply = SynchronousRestFormsRequester.MakeRequest("POST", string reply = SynchronousRestFormsRequester.MakeRequest("POST",
uri, uri,
reqString); reqString,
m_Auth);
if (reply != string.Empty) if (reply != string.Empty)
{ {
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
@ -283,7 +290,8 @@ namespace OpenSim.Services.Connectors
{ {
reply = SynchronousRestFormsRequester.MakeRequest("POST", reply = SynchronousRestFormsRequester.MakeRequest("POST",
uri, uri,
reqString); reqString,
m_Auth);
if (reply == null || (reply != null && reply == string.Empty)) if (reply == null || (reply != null && reply == string.Empty))
{ {
m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgent received null or empty reply"); m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgent received null or empty reply");
@ -327,7 +335,8 @@ namespace OpenSim.Services.Connectors
{ {
reply = SynchronousRestFormsRequester.MakeRequest("POST", reply = SynchronousRestFormsRequester.MakeRequest("POST",
uri, uri,
reqString); reqString,
m_Auth);
if (reply == null || (reply != null && reply == string.Empty)) if (reply == null || (reply != null && reply == string.Empty))
{ {
m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgents received null or empty reply"); m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgents received null or empty reply");

View File

@ -33,13 +33,14 @@ using System.Reflection;
using Nini.Config; using Nini.Config;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Framework.ServiceAuth;
using OpenSim.Server.Base; using OpenSim.Server.Base;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenMetaverse; using OpenMetaverse;
namespace OpenSim.Services.Connectors namespace OpenSim.Services.Connectors
{ {
public class UserAccountServicesConnector : IUserAccountService public class UserAccountServicesConnector : BaseServiceConnector, IUserAccountService
{ {
private static readonly ILog m_log = private static readonly ILog m_log =
LogManager.GetLogger( LogManager.GetLogger(
@ -79,6 +80,8 @@ namespace OpenSim.Services.Connectors
throw new Exception("User account connector init error"); throw new Exception("User account connector init error");
} }
m_ServerURI = serviceURI; m_ServerURI = serviceURI;
base.Initialise(source, "UserAccountService");
} }
public virtual UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) public virtual UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName)
@ -144,7 +147,8 @@ namespace OpenSim.Services.Connectors
{ {
reply = SynchronousRestFormsRequester.MakeRequest("POST", reply = SynchronousRestFormsRequester.MakeRequest("POST",
uri, uri,
reqString); reqString,
m_Auth);
if (reply == null || (reply != null && reply == string.Empty)) if (reply == null || (reply != null && reply == string.Empty))
{ {
m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetUserAccounts received null or empty reply"); m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetUserAccounts received null or empty reply");
@ -224,7 +228,8 @@ namespace OpenSim.Services.Connectors
{ {
reply = SynchronousRestFormsRequester.MakeRequest("POST", reply = SynchronousRestFormsRequester.MakeRequest("POST",
uri, uri,
reqString); reqString,
m_Auth);
if (reply == null || (reply != null && reply == string.Empty)) if (reply == null || (reply != null && reply == string.Empty))
{ {
m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetUserAccount received null or empty reply"); m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetUserAccount received null or empty reply");
@ -260,7 +265,8 @@ namespace OpenSim.Services.Connectors
{ {
string reply = SynchronousRestFormsRequester.MakeRequest("POST", string reply = SynchronousRestFormsRequester.MakeRequest("POST",
uri, uri,
reqString); reqString,
m_Auth);
if (reply != string.Empty) if (reply != string.Empty)
{ {
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);

View File

@ -470,6 +470,16 @@
;; web server ;; web server
; user_agent = "OpenSim LSL (Mozilla Compatible)" ; 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] [XMLRPC]
;# {XmlRpcRouterModule} {} {Module used to route incoming llRemoteData calls} {XmlRpcRouterModule XmlRpcGridRouterModule} XmlRpcRouterModule ;# {XmlRpcRouterModule} {} {Module used to route incoming llRemoteData calls} {XmlRpcRouterModule XmlRpcGridRouterModule} XmlRpcRouterModule

View File

@ -104,6 +104,21 @@ HGAssetServiceConnector = "HGAssetService@8002/OpenSim.Server.Handlers.dll:Asset
; Password for cert ; Password for cert
; cert_pass = "password" ; 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 ; * The following are for the remote console
; * They have no effect for the local or basic console types ; * They have no effect for the local or basic console types

View File

@ -81,6 +81,19 @@ MapGetServiceConnector = "8002/OpenSim.Server.Handlers.dll:MapGetServiceConnecto
; Password for cert ; Password for cert
; cert_pass = "password" ; 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 ; * The following are for the remote console
; * They have no effect for the local or basic console types ; * They have no effect for the local or basic console types

View File

@ -111,6 +111,7 @@
<Files> <Files>
<Match pattern="*.cs" recurse="false"/> <Match pattern="*.cs" recurse="false"/>
<Match path="Client" pattern="*.cs" recurse="true"/> <Match path="Client" pattern="*.cs" recurse="true"/>
<Match path="ServiceAuth" pattern="*.cs" recurse="true"/>
</Files> </Files>
</Project> </Project>