OAuth in Kafka with Keycloak #12278
-
|
Hello everyone, I am trying to unwrap my head around setting up OAuth in Kafka with Keycloak. Tried out setting up as mentioned in the documentation along with examples in GH. I set-up Keycloak in my local kind cluster and configured it with kafka-authz.json (in GH example linked above). I am facing some issues which are not clear to me as I am following as suggested. Doubt-1: while kafka-oauth code files has enabled it. See here To rule this out I did exactly as mentioned in the official documentation: and, removed this from my config: And, I faced an error in my kafka broker pod logs: Then I added both to my config: Then when I try I do not see any ACL related error. Please advise should we enable it or disable it? Doubt-2: My team-a.properties: While producing a message on No logs in Kafka broker pod logs. While keycloak pod has logs as: When I run this to get the JWT for team-a-client I see as what it is allowed to do: cURL Response: If Dev Team A has full ownership for all topics starting with Our AI friends have drawn this for me from kafka-authz.json:
Not sure what is missing in my config. Any hints regarding this would be very helpful and appreciated. Many thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
|
The following stacktrace: Tells me that you are trying to list ACLs while using KeycloakAuthorizer with delegation disabled. That's in line with what you mention above how you configure the KeycloakAuthorizer. Here's the code that throws the exception: https://github.com/strimzi/strimzi-kafka-oauth/blob/0.17.0/oauth-keycloak-authorizer/src/main/java/io/strimzi/kafka/oauth/server/authorizer/KeycloakRBACAuthorizer.java#L599 If you disable delegation then you can not list the standard ACLs as the listing command can not be delegated. It seems that the behaviour is correct. Usually when using KeycloakAuthorizer, you put all your users in Keycloak and you configure their permissions in Keycloak as described in the documentation (https://github.com/strimzi/strimzi-kafka-oauth/blob/0.17.1/examples/README-authz.md#using-keycloak-admin-console-to-configure-authorization). Hopefully the configuration documentation is up-to-date and correct. If you find inconsistencies, please let us know. |
Beta Was this translation helpful? Give feedback.
-
|
When using The |
Beta Was this translation helpful? Give feedback.
-
You can enable Strimzi OAuth library logging for OAuth and Keycloak authorization by setting logging level for logger |
Beta Was this translation helpful? Give feedback.
-
If you get this error while following the instructions to the letter, it might mean that the documentation is out of sync. I'll have to do a run through the instructions to see if I get the same error. |
Beta Was this translation helpful? Give feedback.


The following stacktrace: