30 using System.Collections.Generic;
32 using System.Reflection;
34 using OpenSim.Framework;
35 using OpenSim.Services.Interfaces;
38 namespace OpenSim.Services.Connectors
42 private static readonly ILog m_log =
44 MethodBase.GetCurrentMethod().DeclaringType);
46 private string m_ServerURI = String.Empty;
47 private bool m_ResponseOnFailure =
true;
55 m_ServerURI = serverURI.TrimEnd(
'/');
65 IConfig authorizationConfig = source.Configs[
"AuthorizationService"];
66 if (authorizationConfig == null)
69 throw new Exception(
"Authorization connector init error");
72 string serviceURI = authorizationConfig.GetString(
"AuthorizationServerURI",
75 if (serviceURI == String.Empty)
77 m_log.Error(
"[AUTHORIZATION CONNECTOR]: No Server URI named in section AuthorizationService");
78 throw new Exception(
"Authorization connector init error");
80 m_ServerURI = serviceURI;
84 bool responseOnFailure = authorizationConfig.GetBoolean(
"ResponseOnFailure",
true);
86 m_ResponseOnFailure = responseOnFailure;
87 m_log.Info(
"[AUTHORIZATION CONNECTOR]: AuthorizationService initialized");
90 public bool IsAuthorizedForRegion(
string userID,
string firstname,
string surname,
string email,
string regionName,
string regionID, out
string message)
93 m_log.InfoFormat(
"[AUTHORIZATION CONNECTOR]: IsAuthorizedForRegion checking {0} at remote server {1}", userID, m_ServerURI);
95 string uri = m_ServerURI;
106 m_log.WarnFormat(
"[AUTHORIZATION CONNECTOR]: Unable to send authorize {0} for region {1} error thrown during comms with remote server. Reason: {2}", userID, regionID, e.Message);
108 return m_ResponseOnFailure;
110 if (response == null)
112 message =
"Null response";
113 return m_ResponseOnFailure;
115 m_log.DebugFormat(
"[AUTHORIZATION CONNECTOR] response from remote service was {0}", response.Message);
116 message = response.Message;
118 return response.IsAuthorized;
AuthorizationServicesConnector(IConfigSource source)
bool IsAuthorizedForRegion(string userID, string firstname, string surname, string email, string regionName, string regionID, out string message)
virtual void Initialise(IConfigSource source)
AuthorizationServicesConnector(string serverURI)
AuthorizationServicesConnector()