omkreddy commented on code in PR #14083: URL: https://github.com/apache/kafka/pull/14083#discussion_r1293480410
########## 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: I agree. then we should also add `allowTokenRequests(request)` check to all controller APIs? -- 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