Move NullAuthentication and AuthorizeAll extensions to plugins.

0.6.3-post-fixes
Mike Mazur 2009-02-16 02:26:52 +00:00
parent 02cf9f7e9f
commit 932e591e05
5 changed files with 74 additions and 14 deletions

View File

@ -122,6 +122,8 @@ namespace OpenSim.Grid.AssetInventoryServer
} }
frontends.AddRange(LoadAssetInventoryServerPlugins("/OpenSim/AssetInventoryServer/Frontend", String.Empty)); frontends.AddRange(LoadAssetInventoryServerPlugins("/OpenSim/AssetInventoryServer/Frontend", String.Empty));
AuthenticationProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AuthenticationProvider", String.Empty) as IAuthenticationProvider;
AuthorizationProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AuthorizationProvider", String.Empty) as IAuthorizationProvider;
return true; return true;
} }

View File

@ -102,14 +102,14 @@ namespace OpenSim.Grid.AssetInventoryServer
BackendResponse TryPurgeFolder(Uri owner, UUID folderID); BackendResponse TryPurgeFolder(Uri owner, UUID folderID);
} }
public interface IAuthenticationProvider public interface IAuthenticationProvider : IAssetInventoryServerPlugin
{ {
void AddIdentifier(UUID authToken, Uri identifier); void AddIdentifier(UUID authToken, Uri identifier);
bool RemoveIdentifier(UUID authToken); bool RemoveIdentifier(UUID authToken);
bool TryGetIdentifier(UUID authToken, out Uri identifier); bool TryGetIdentifier(UUID authToken, out Uri identifier);
} }
public interface IAuthorizationProvider public interface IAuthorizationProvider : IAssetInventoryServerPlugin
{ {
bool IsMetadataAuthorized(UUID authToken, UUID assetID); bool IsMetadataAuthorized(UUID authToken, UUID assetID);
/// <summary> /// <summary>

View File

@ -28,28 +28,54 @@
*/ */
using System; using System;
using ExtensionLoader;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework;
namespace OpenSim.Grid.AssetInventoryServer.Extensions namespace OpenSim.Grid.AssetInventoryServer.Plugins
{ {
public class AuthorizeAll : IExtension<AssetInventoryServer>, IAuthorizationProvider public class AuthorizeAllPlugin : IAuthorizationProvider
{ {
AssetInventoryServer server; AssetInventoryServer server;
public AuthorizeAll() public AuthorizeAllPlugin()
{ {
} }
public void Start(AssetInventoryServer server) #region IPlugin implementation
public void Initialise(AssetInventoryServer server)
{ {
this.server = server; this.server = server;
Logger.Log.Info("[ASSET] Authorize All loaded.");
} }
public void Stop() /// <summary>
/// <para>Initialises asset interface</para>
/// </summary>
public void Initialise()
{
Logger.Log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name);
throw new PluginNotInitialisedException(Name);
}
public void Dispose()
{ {
} }
public string Version
{
// TODO: this should be something meaningful and not hardcoded?
get { return "0.1"; }
}
public string Name
{
get { return "AssetInventoryServer Null authentication frontend"; }
}
#endregion IPlugin implementation
public bool IsMetadataAuthorized(UUID authToken, UUID assetID) public bool IsMetadataAuthorized(UUID authToken, UUID assetID)
{ {
return true; return true;

View File

@ -28,28 +28,54 @@
*/ */
using System; using System;
using ExtensionLoader;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework;
namespace OpenSim.Grid.AssetInventoryServer.Extensions namespace OpenSim.Grid.AssetInventoryServer.Plugins
{ {
public class NullAuthentication : IExtension<AssetInventoryServer>, IAuthenticationProvider public class NullAuthenticationPlugin : IAuthenticationProvider
{ {
AssetInventoryServer server; AssetInventoryServer server;
public NullAuthentication() public NullAuthenticationPlugin()
{ {
} }
public void Start(AssetInventoryServer server) #region IPlugin implementation
public void Initialise(AssetInventoryServer server)
{ {
this.server = server; this.server = server;
Logger.Log.Info("[ASSET] Null Authentication loaded.");
} }
public void Stop() /// <summary>
/// <para>Initialises asset interface</para>
/// </summary>
public void Initialise()
{
Logger.Log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name);
throw new PluginNotInitialisedException(Name);
}
public void Dispose()
{ {
} }
public string Version
{
// TODO: this should be something meaningful and not hardcoded?
get { return "0.1"; }
}
public string Name
{
get { return "AssetInventoryServer Null authentication frontend"; }
}
#endregion IPlugin implementation
public void AddIdentifier(UUID authToken, Uri identifier) public void AddIdentifier(UUID authToken, Uri identifier)
{ {
} }

View File

@ -16,4 +16,10 @@
<Extension path="/OpenSim/AssetInventoryServer/Frontend"> <Extension path="/OpenSim/AssetInventoryServer/Frontend">
<Plugin id="ReferenceFrontend" provider="OpenSim.Grid.AssetInventoryServer.Plugins.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.ReferenceFrontendPlugin" /> <Plugin id="ReferenceFrontend" provider="OpenSim.Grid.AssetInventoryServer.Plugins.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.ReferenceFrontendPlugin" />
</Extension> </Extension>
<Extension path="/OpenSim/AssetInventoryServer/AuthenticationProvider">
<Plugin id="NullAuthentication" provider="OpenSim.Grid.AssetInventoryServer.Plugins.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.NullAuthenticationPlugin" />
</Extension>
<Extension path="/OpenSim/AssetInventoryServer/AuthorizationProvider">
<Plugin id="AuthorizeAll" provider="OpenSim.Grid.AssetInventoryServer.Plugins.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.AuthorizeAllPlugin" />
</Extension>
</Addin> </Addin>