Hi,
In the XWiki Security API module there appears to be a DefaultAuthorizationManagerConfiguration
class which implements an org.xwiki.security.authorization.AuthorizationManagerConfiguration
interface.
I’d like to override/replace the DefaultAuthorizationManagerConfiguration
with my own implementation which is packaged up in my own extension.
Is that possible?
My implementation has @Component(roles = AuthorizationManagerConfiguration.class)
and my class is listed in components.txt
. I have tried using the 0:
prefix in components.txt
in order to override the “default” of DefaultAuthorizationManagerConfiguration
, and I’ve tried without the 0:
but neither seems to work.
If what I’m trying to do is meant to be possible, any ideas as to what might be going wrong?
Thanks in advance,
Alex
Currently, that prefix is only effective when the two components are loaded in from the same classloader (the ComponentManager itself does not know this basically).
From your test, it seems your only option is to put your JAR in WEB-INF/lib (in which case the prefix will indeed be important). In short, it means that component is injected too early (before installed extensions are loaded).
Thanks @tmortagne, I’ll try dropping it into WEB-INF/lib.
The reason behind this is that when “security.authorization.settler” is set, if the extension containing the value is not yet installed, XWiki fails to start. As such, I was hoping to override that behaviour such that the XWiki Security API uses it’s own defaults when the extension is not deployed, and then uses my extension when it is (due to my extension overriding the Security API config class).
If I’m going to be dropping my extension into WEB-INF/lib, I don’t think I’ll need to override the Security API config class as my “extension” will always be present (I’m using Docker so my extension will be baked into the image).
Cheers