From ff9da2446583ffd95b42e7ced2a86c2166c993c1 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 23 May 2014 17:31:39 -0700 Subject: Added HTTP Authentication also to Groups and offline IM. --- .../OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs') diff --git a/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs b/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs index eb287a4..047b8be 100644 --- a/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs +++ b/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs @@ -32,6 +32,7 @@ using System.Reflection; using System.Text; using OpenSim.Framework; +using OpenSim.Framework.ServiceAuth; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; @@ -46,6 +47,7 @@ namespace OpenSim.OfflineIM private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private string m_ServerURI = string.Empty; + private IServiceAuth m_Auth; private object m_Lock = new object(); public OfflineIMServiceRemoteConnector(string url) @@ -65,6 +67,18 @@ namespace OpenSim.OfflineIM m_ServerURI = cnf.GetString("OfflineMessageURL", string.Empty); + /// This is from BaseServiceConnector + string authType = Util.GetConfigVarFromSections(config, "AuthType", new string[] { "Network", "Messaging" }, "None"); + + switch (authType) + { + case "BasicHttpAuthentication": + m_Auth = new BasicHttpAuthentication(config, "Messaging"); + break; + } + /// + m_log.DebugFormat("[OfflineIM.V2.RemoteConnector]: Offline IM server at {0} with auth {1}", + m_ServerURI, (m_Auth == null ? "None" : m_Auth.GetType().ToString())); } #region IOfflineIMService @@ -143,7 +157,8 @@ namespace OpenSim.OfflineIM lock (m_Lock) reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI + "/offlineim", - ServerUtils.BuildQueryString(sendData)); + ServerUtils.BuildQueryString(sendData), + m_Auth); Dictionary replyData = ServerUtils.ParseXmlResponse( reply); -- cgit v1.1