Skip to content

Conversation

gtato
Copy link

@gtato gtato commented Mar 9, 2024

This change allows schema registry clients to specify a token in case the registry server supports token/oidc authentication.

@gtato gtato requested a review from a team as a code owner March 9, 2024 21:29
Copy link

cla-assistant bot commented Mar 9, 2024

CLA assistant check
All committers have signed the CLA.

@rayokota rayokota added the component:schema-registry Any schema registry related isues rather than kafka isolated ones label Jul 13, 2024
@iamed2
Copy link

iamed2 commented Aug 14, 2024

When using Bearer auth from curl, we needed to provide additional headers for Confluent-Identity-Pool-Id and target-sr-cluster. Have you succeeded in using this branch to connect?

Additionally, needing to recreate the client whenever a token refresh is needed is cumbersome. Inserting a user-provided token-fetching callback as part of a custom auth for the Requests Session may be a more user-friendly option. A custom auth could look something like:

class BearerAuth(requests.auth.AuthBase):
    def __init__(self, token_cb):
        self.token_cb = token_cb

    def __call__(self, request):
        """Called directly by requests to add the Authorization header"""
        token = token_cb()
        request.headers["Authorization"] = f"Bearer {token}"
        return request

and you can hook this in by setting self.session.auth = BearerAuth(token_cb).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:schema-registry Any schema registry related isues rather than kafka isolated ones
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants