danoSF opened a new pull request, #22594:
URL: https://github.com/apache/kafka/pull/22594
The CreateTopicPolicy and AlterConfigPolicy plugin interfaces let operators
constrain the *shape* of a request (topic name, partitions, replication factor,
configs) but not *who* issued it. In multi-tenant clusters this prevents a
policy from enforcing per-principal rules that prefixed ACLs cannot express,
e.g. "tenant-a may only create topics with replication.factor <= 3" or
per-principal topic/partition quotas.
This change exposes the authenticated KafkaPrincipal to both policies:
* CreateTopicPolicy.RequestMetadata and AlterConfigPolicy.RequestMetadata
gain an overloaded constructor that accepts a KafkaPrincipal and an
Optional<KafkaPrincipal> principal() accessor. The existing constructors are
retained and delegate with a null principal, so the change is source- and
binary-compatible for existing policy implementations. The principal is
excluded from equals()/hashCode() (it is request-scoped metadata, not part of
the identity of the requested change) and included in toString().
* The KRaft controller populates the principal from
ControllerRequestContext.principal(): ReplicationControlManager passes it to
CreateTopicPolicy, and it is threaded through ConfigurationControlManager
(alongside the existing 'forwarded' parameter) to AlterConfigPolicy for both
the incremental and legacy alter-configs paths. The legacy ZooKeeper path is
intentionally out of scope.
Policies constructed without a principal (including via the legacy
constructors) observe Optional.empty().
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]