Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

Content for OAuth2/OIDC support for Kafka REST proxy #2237

Merged
merged 10 commits into from
Nov 14, 2023

Conversation

harshini-rangaswamy
Copy link
Contributor

@harshini-rangaswamy harshini-rangaswamy commented Nov 7, 2023

What changed, and why it matters

Added content for OAuth2/OIDC support for Kafka REST proxy - DOC-592

Note: I will remove the Enable Apache Kafka® REST proxy authorization topic, as I have included this content within this new topic "Enable OAuth2/OIDC support for Apache Kafka® REST proxy".

Copy link

cloudflare-workers-and-pages bot commented Nov 7, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3b4276a
Status: ✅  Deploy successful!
Preview URL: https://1f454e93.devportal.pages.dev
Branch Preview URL: https://harshini-oauth-oidc-rest-pro.devportal.pages.dev

View logs

Authorization enforcement
----------------------------

The underlying Aiven for Apache Kafka® service uses the ``sub`` claim from the JWT as the username, checking it against configured Access Control Lists (ACLs) to authorize operations on Kafka resources.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A small thing here, the default is indeed the sub claim, however on the Kafka side this is configurable via kafka.sasl_oauthbearer_sub_claim_name, as also mentioned in https://docs.aiven.io/docs/products/kafka/howto/enable-oidc#enable-oauth2-oidc-via-aiven-console

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And currently the service user matching the value in the claim is needed, just the ACL entry is not enough.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks both for your feedback. I have made some changes to the text and would appreciate it if you could review it again.

@harshini-rangaswamy harshini-rangaswamy marked this pull request as ready for review November 10, 2023 16:04
Copy link

@matyaskuti matyaskuti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!
@jjaakola-aiven could you also check again?

@harshini-rangaswamy harshini-rangaswamy force-pushed the harshini-oauth-oidc-rest-proxy branch from c6d4b02 to ed69c14 Compare November 13, 2023 15:03
@harshini-rangaswamy harshini-rangaswamy force-pushed the harshini-oauth-oidc-rest-proxy branch from ed69c14 to 231c420 Compare November 13, 2023 15:18

While the ``sub`` claim is the default identifier, this setting is configurable. You can specify a different JWT claim for authentication by adjusting the ``kafka.sasl_oauthbearer_sub_claim_name`` parameter. For more information on configuring this, see :ref:`console-authentication`.

To authenticate and authorize a user in Aiven for Apache Kafka, the JWT claim value and corresponding service user must be explicitly present in the ACL. This means that the identity of the user making the request with the JWT claim value must match the service user in the system.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to think how to change the text to be more specific that both are needed. Now I feel that this paragraph mixes/is not exact enough with the difference.

  1. a matching ACL entry
  2. a matching service user

For example this would work.

  1. Service user with username userid-example.
  2. ACL entry
    1. username userid-ex*
    2. topic example-topic
    3. permission read|write|readwrite|admin

If service user would be removed from the Aiven for Kafka the authorization would start to fail. This is a bit counter intuitive as ACL should be the only item to affect authorization with OAuth2/OIDC but our system currently links the service users and ACL entries. There is a ticket to remove this link: https://aiven.atlassian.net/browse/HH-2792

So maybe something like this would be better:
To authenticate and authorize a user in Aiven for Apache Kafka a service user and ACL entry describing the permissions is needed. This means that the identity of the user making the request with the JWT claim value must match the service user in the system and must match the ACL entry.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jjaakola-aiven I've made the following text updates. Could you check them and confirm if they're alright?

To authenticate and authorize a user in Aiven for Apache Kafka, both a service user and an ACL entry describing the permissions are required. The JWT claim value used for authentication must explicitly match the service user in the system. Furthermore, this service user must be associated with an ACL entry that outlines their permissions, ensuring that the identity of the user making the request aligns with both the service user and the ACL entry.

@harshini-rangaswamy harshini-rangaswamy merged commit a5dac55 into main Nov 14, 2023
5 checks passed
@harshini-rangaswamy harshini-rangaswamy deleted the harshini-oauth-oidc-rest-proxy branch November 14, 2023 07:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Kafka Kafka-related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants