It would be nice to be able to pass authorization policies in the JWT instead of storing them in Keycloak in order to make the OAuth2 integration more generic and less reliant on specific identity/access management services.
The use-case is when using a custom authentication/authorization service with OAuth2, e.g., Azure Active Directory B2C. The service can be a source of truth for policies and pass these policies as a part of the JWT. Upon receiving the JWT, the Kafka Authorizer looks at the policies and grants permission based on them.
For example, the JWT can look like:
{
...
"policies": [ "cluster_a:topic_b:write|describe", "*:topic_*:all" ]
}
I can work on implementing this.