Fix XBakes simulator-side authentication regression failure

Unlike the other connectors, XBakes uses a service auth retrieved from ServiceAuth.Create() and not code inherited from BaseServiceConnector.
Fixes regression from 7d3bafd5 (Wed 4 Mar 2015) where the new CompoundAuthenticator did not implement IServiceAuth.AddAuthorization()
inv-download
Justin Clark-Casey (justincc) 2015-03-16 23:40:34 +00:00
parent e6889a6023
commit eda09d8763
5 changed files with 29 additions and 3 deletions

View File

@ -40,6 +40,8 @@ namespace OpenSim.Framework.ServiceAuth
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public string Name { get { return "BasicHttp"; } }
private string m_Username, m_Password;
private string m_CredentialsB64;

View File

@ -35,10 +35,17 @@ namespace OpenSim.Framework.ServiceAuth
{
public class CompoundAuthentication : IServiceAuth
{
public string Name { get { return "Compound"; } }
private List<IServiceAuth> m_authentications = new List<IServiceAuth>();
public int Count { get { return m_authentications.Count; } }
public List<IServiceAuth> GetAuthentors()
{
return new List<IServiceAuth>(m_authentications);
}
public void AddAuthenticator(IServiceAuth auth)
{
m_authentications.Add(auth);
@ -49,7 +56,11 @@ namespace OpenSim.Framework.ServiceAuth
m_authentications.Remove(auth);
}
public void AddAuthorization(NameValueCollection headers) {}
public void AddAuthorization(NameValueCollection headers)
{
foreach (IServiceAuth auth in m_authentications)
auth.AddAuthorization(headers);
}
public bool Authenticate(string data)
{

View File

@ -33,6 +33,8 @@ namespace OpenSim.Framework.ServiceAuth
{
public class DisallowLlHttpRequest : IServiceAuth
{
public string Name { get { return "DisallowllHTTPRequest"; } }
public void AddAuthorization(NameValueCollection headers) {}
public bool Authenticate(string data)

View File

@ -36,6 +36,11 @@ namespace OpenSim.Framework.ServiceAuth
public interface IServiceAuth
{
/// <summary>
/// Name of this authenticator.
/// </summary>
string Name { get; }
bool Authenticate(string data);
bool Authenticate(NameValueCollection headers, AddHeaderDelegate d, out HttpStatusCode statusCode);
void AddAuthorization(NameValueCollection headers);

View File

@ -27,13 +27,16 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using log4net;
using Nini.Config;
namespace OpenSim.Framework.ServiceAuth
{
public class ServiceAuth
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public static IServiceAuth Create(IConfigSource config, string section)
{
CompoundAuthentication compoundAuth = new CompoundAuthentication();
@ -53,6 +56,9 @@ namespace OpenSim.Framework.ServiceAuth
break;
}
// foreach (IServiceAuth auth in compoundAuth.GetAuthentors())
// m_log.DebugFormat("[SERVICE AUTH]: Configured authenticator {0}", auth.Name);
if (compoundAuth.Count > 0)
return compoundAuth;
else