pprovenzano commented on code in PR #14083:
URL: https://github.com/apache/kafka/pull/14083#discussion_r1293465257


##########
core/src/main/scala/kafka/server/ControllerApis.scala:
##########
@@ -842,6 +847,75 @@ class ControllerApis(val requestChannel: RequestChannel,
       }
   }
 
+  def handleCreateDelegationTokenRequest(request: RequestChannel.Request): 
CompletableFuture[Unit] = {
+    val alterRequest = request.body[CreateDelegationTokenRequest]
+
+    val requester = request.context.principal
+    val ownerPrincipalName = alterRequest.data.ownerPrincipalName
+    val ownerPrincipalType = alterRequest.data.ownerPrincipalType
+    val owner = if (ownerPrincipalName == null || ownerPrincipalName.isEmpty) {
+      request.context.principal
+    } else {
+      new KafkaPrincipal(ownerPrincipalType, ownerPrincipalName)
+    }
+
+    // Requester is always allowed to create token for self
+    if (!owner.equals(requester) && 

Review Comment:
   We may in the future allow for talking directly to the kcontroller nodes and 
so all checks need to be done in the kcontroller too.
   



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to