Repository navigation
Description
Proposal: optional PAP change listener for policies, PDP configuration and attribute providers
Hello maintainers,
We would like to contribute a small, optional extension point to AuthzForce Server and would appreciate your feedback before implementing a PR.
Our use case is a central AuthzForce PAP with embedded AuthzForce PDPs in downstream services. We want to notify those services when relevant PAP operations succeed, while keeping messaging libraries and delivery infrastructure outside AuthzForce Server.
Proposed scope
Introduce a framework-independent Java listener and immutable event, for example:
public interface PapChangeListener {
void papChanged(PapChangeEvent event);
}Names and API details are open for discussion. The event would identify the domain, operation type, and policy ID/version where applicable, with an event identifier and timestamp. We would avoid including sensitive attribute-provider configuration in notification payloads.
The initial scope would cover:
- Addition of a policy/version.
- Removal of a policy version or all versions of a policy.
- Changes to PDP configuration, including the root policy reference.
- Changes to attribute-provider configuration.
- Domain deletion, if you consider it appropriate for this contract.
Attribute-provider configuration changes are in scope; changes to external data queried by a provider are not.
Events would describe successful PAP operations, rather than claim that every added policy version becomes active. Rejected requests, conflicting policy versions and not-found deletions would not emit successful-change events.
Candidate integration points
In the local checkout reviewed (server 12.1.1-SNAPSHOT), the candidate methods are:
DomainResourceImpl.addPolicy()DomainResourceImpl.updateOtherPdpProperties()DomainResourceImpl.updateAttributeProviderList()DomainResourceImpl.deleteDomain()PolicyResourceImpl.deletePolicy()PolicyVersionResourceImpl.deletePolicyVersion()
Notification would occur after the DAO call and its result checks. For example, addPolicy() must check for a conflicting policy before emitting an event.
We propose keeping these hooks in the server API layer to avoid changes to the PDP engine or the flat-file persistence component. This deliberately scopes notifications to operations performed through the PAP API, rather than all underlying filesystem changes or individual automatic version-rolling effects.
The implementation would also require bounded changes to resource factories/constructors to propagate the notifier and domain context. We would preserve existing construction paths where feasible.
Configuration and extension packaging
The listener would be optional, with no notifications or additional behavior when none is configured. We propose using the existing Spring wiring in the webapp to register external listener implementations, with a documented configuration extension point.
An integrator could compile a listener in a separate JAR and deploy it with its dependencies in the web application's classpath. Deployment/repackaging and restart may be necessary, but changing an implementation would not require modifying AuthzForce source code.
No new third-party runtime dependency would be needed for the upstream hook. Broker clients, persistent event queues, publishers, retries and consumers would remain in external integrations.
For the initial contract, we suggest a synchronous callback that should finish promptly. Listener runtime failures would be logged without changing an already-successful PAP operation into an HTTP failure. The latency, concurrency and exception semantics would be documented and tested; we welcome your preference here.
Reliability boundaries
This proposal is not a transactional outbox or a delivery guarantee. A process failure between policy persistence and listener execution can lose a notification. A persistent queue populated by a listener only protects events successfully recorded in that queue.
Our downstream integration would combine push notifications with startup and periodic reconciliation against the PAP to recover the current policy/configuration state. This provides eventual convergence after recovery, not preservation of every intermediate change or immediate revocation during a missed notification.
No changes to the policy storage format, DAO persistence protocol or PDP evaluation engine are proposed.
Validation
We would add tests for successful operations, conflicts and failed operations, no-listener behavior, listener exceptions, and correct domain context under concurrent requests, using the existing test infrastructure.
Feedback requested
- Would you consider a server-level PAP change listener within this scope suitable for an upstream PR, or is there an existing extension point you would recommend?
- Do the proposed operation coverage and API-layer hook locations make sense, especially for attribute-provider and root-policy configuration changes?
- What package/API placement and external-listener configuration mechanism would you prefer?
- Would the proposed callback and error-handling semantics be acceptable?
We are happy to adjust the design before implementing the contribution. If another tracker or discussion channel is preferred, please let us know.
Activity
cdanger commentedon Oct 18, 2026
Yes, that's a good case for a PR indeed. There's no extension point for this at the moment.
Yes, it makes sense to me, adding the hooks into the
DomainResourceImpl,PolicyResourceImplandPolicyVersionResourceImplclasses for the new listener.For the configuration, the way I see it, you add a new constructor argument to the
DomainsResourceImplclass for passing the PapChangeListener instance (which the modified DomainsResourceImpl can then pass down toDomainResourceImpl,PolicyResourceImpl, etc.) . Then you modify thedomainsResourceBeandeclaration in the Spring XML config (/webapp/src/main/webapp/WEB-INF/beans.xml) to make this argument value configurable:If you are using a JNDI variable, you can pre-declare it with a proper description in
/dist/src/webapp-context.xml, for instance:Then, at deployment time, this goes into
/etc/tomcat11/Catalina/localhost/authzforce-ce.xml, so that users only have to change thevaluethere to whatever custom PapChangeListener implementation class they are using. Of course, this assumes that the listener's JAR has been put somewhere on Tomcat classpath, e.g./opt/authzforce-ce-server/webapp/WEB-INF/libor elsewhere according to Tomcat HowTo.Sounds good, but I would need to look at the PR to be sure.