Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keycloak relam definition for Kafka Strimzi #204

Open
natbronislavska opened this issue Oct 4, 2023 · 2 comments
Open

Keycloak relam definition for Kafka Strimzi #204

natbronislavska opened this issue Oct 4, 2023 · 2 comments

Comments

@natbronislavska
Copy link

I am using Keycloak for authentication (oauth) and KafkaUser for authorization (simple) and I have currently only enabled this on the external listener. I created a simple Keycloak realm, strongly inspired by the one found in the examples: https://github.com/strimzi/strimzi-kafka-oauth/blob/main/examples/docker/keycloak-import/realms/demo-realm.json

I have two questions about this realm definition:

  1. client definition - "directAccessGrantsEnabled" - I have tested my installation with the value set to both true and false and it doesn't seem to have any impact on authentication. What is it used for?
  2. scopeMapping - "offline_access" - is it necessary? is it used?
@scholzj
Copy link
Member

scholzj commented Oct 4, 2023

@mstruk might know ...

@mstruk
Copy link
Contributor

mstruk commented Oct 4, 2023

  1. client definition - "directAccessGrantsEnabled"

As the Keycloak documentation says: "Direct Access Grants are used by REST clients to obtain tokens on behalf of users."

It is for use with OAuth clients that act as user agents (like REST services that serve users and require users to authenticate), rather than act in their own name (as is the case with service accounts). My advice would be to not enable Direct Access Grants unless you find that you need them in order for things to work. The Kafka client micro services that just run some message processing on data rather than serve individual users normally don't need this enabled as they use service accounts.

  1. scopeMapping - "offline_access"

This results in token endpoint returning a refresh token that never expires. It is useful when you authenticate with curl or wget directly to the token endpoint specifying scope=offline_access which returns a refresh_token that has no expiry (in addition to the access_token). You can then use that token as the value of oauth.refresh.token client configuration parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants