At the moment this resource is quite verbose but the tasks it performs are very simple.
Firstly it only makes sense to have a single policy defined, the outcome of this resource is JVM wide registration so multiple definitions would lead to undefined behaviour.
Secondly this provides two primary functions.
1. Instantation of https://docs.oracle.com/javase/8/docs/api/java/security/Policy.html and registration via a call to https://docs.oracle.com/javase/8/docs/api/java/security/Policy.html#setPolicy-java.security.Policy-
This first point needs a class name for the policy as well as a module.
2. Registration of the JVM wide https://jakarta.ee/specifications/platform/8/apidocs/javax/security/jacc/PolicyConfigurationFactory.html again needing a classname and module.
This is also not working correctly but the immediate bug is being addressed under
The JACC APIs don't actually provide a nice way to register this so maybe this is something we should also propose via the spec, but this piece is effectively a class name and module name.
We have ended up with custom and jacc variants as alternatives. Really both variants are optional but if the resource is defined at least one must be set.
It may make sense for JACC to move to it's own subsystem for a couple of reasons.
The JVM wide policy will likely need to be possible in both subsystems but use a capability to ensure it is defined in only one. We probably should move it's registration into the boot operations so registration is complete before DUPs begin.
The PolicyConfigurationFactory would then be in a JACC subsystem only. Again handling during a boot operation may be preferable otherwise we see issues like
WFLY-13615 but failing that ensuring the deployment depend upon the registration happening may be sufficient.
Additionally the resource has some hard coded class names for the Policy and PolicyConfigurationFactory, we probably should not have these as class names and instead default to them if not defined - this means we still need a way to optionally activate their registration if JACC is required on the server.
It probably should also be possible to independently set the module for Policy and PolicyContextHandler as these will presently be shared.