Add the m_Enabled pattern to Simian Auth

viewer-2-initial-appearance
Melanie 2010-09-05 17:44:02 +01:00
parent d9e9c41e13
commit a407ad38f6
1 changed files with 22 additions and 12 deletions

View File

@ -51,6 +51,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
MethodBase.GetCurrentMethod().DeclaringType); MethodBase.GetCurrentMethod().DeclaringType);
private string m_serverUrl = String.Empty; private string m_serverUrl = String.Empty;
private bool m_Enabled = false;
#region ISharedRegionModule #region ISharedRegionModule
@ -61,8 +62,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
public SimianAuthenticationServiceConnector() { } public SimianAuthenticationServiceConnector() { }
public string Name { get { return "SimianAuthenticationServiceConnector"; } } public string Name { get { return "SimianAuthenticationServiceConnector"; } }
public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface<IAuthenticationService>(this); } } public void AddRegion(Scene scene) { if (m_Enabled) { scene.RegisterModuleInterface<IAuthenticationService>(this); } }
public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface<IAuthenticationService>(this); } } public void RemoveRegion(Scene scene) { if (m_Enabled) { scene.UnregisterModuleInterface<IAuthenticationService>(this); } }
#endregion ISharedRegionModule #endregion ISharedRegionModule
@ -73,20 +74,29 @@ namespace OpenSim.Services.Connectors.SimianGrid
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{ {
IConfig gridConfig = source.Configs["AuthenticationService"]; IConfig moduleConfig = source.Configs["Modules"];
if (gridConfig != null) if (moduleConfig != null)
{ {
string serviceUrl = gridConfig.GetString("AuthenticationServerURI"); string name = moduleConfig.GetString("AssetServices", "");
if (!String.IsNullOrEmpty(serviceUrl)) if (name == Name)
{ {
if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) IConfig gridConfig = source.Configs["AuthenticationService"];
serviceUrl = serviceUrl + '/'; if (gridConfig != null)
m_serverUrl = serviceUrl; {
string serviceUrl = gridConfig.GetString("AuthenticationServerURI");
if (!String.IsNullOrEmpty(serviceUrl))
{
if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
serviceUrl = serviceUrl + '/';
m_serverUrl = serviceUrl;
m_Enabled = true;
}
}
if (String.IsNullOrEmpty(m_serverUrl))
m_log.Info("[SIMIAN AUTH CONNECTOR]: No AuthenticationServerURI specified, disabling connector");
} }
} }
if (String.IsNullOrEmpty(m_serverUrl))
m_log.Info("[SIMIAN AUTH CONNECTOR]: No AuthenticationServerURI specified, disabling connector");
} }
public string Authenticate(UUID principalID, string password, int lifetime) public string Authenticate(UUID principalID, string password, int lifetime)