Closed BewareMyPower closed 1 year ago
I'm curious why don't we make these changes to the c++ client?
Of course we can. But with this PR, we can have this feature without releasing a new version of the C++ client. If there is something wrong with the implementation of the C++ client, we have to raise a new release.
From my understanding, it's a missing feature in the C++ client. Right? If so, I suggest we implement it in the C++ client even though we need to cut a new release.
If so, I suggest we implement it in the C++ client even though we need to cut a new release.
We can implement it in the C++ client. But we don't have to reuse the C++ implementation from the Python side because:
And as I've said before:
If there is something wrong with the implementation of the C++ client, we have to raise a new release.
The Python client should only depends on the C++ client for basic Pulsar protocol implementations. Otherwise, many bug fixes would require the fix at the C++ side.
For example, ideally, the OAuth2 authentication provider could be implemented fully at the Python side. It can also avoid the issue like we have met before.
This PR of change is similar to the conversion of parameters, which is lightweight. So I think it can be implemented on the python side (it will be handed over to the user faster than the implementation on the cpp side)
If the CPP client has the same problem, we should create the corresponding issue in the CPP repo. After CPP support it, maybe we can remove it on the Python side as well.
@merlimat Could you share your thoughts? I'd like to hear more opinions about whether should we implement it first in Python client. Or whether should we have multiple implementations for different languages.
I will implement this feature in C++ client first. Mark it as drafted
Fix by apache/pulsar-client-cpp#249
Fixes https://github.com/apache/pulsar-client-python/issues/101
Motivation
Currently the
private_key
field of the JSON passed toAuthenticationOauth2
only represents the path to the file, we need to support passing the base64 encoded JSON string.Modifications
Since the C++ client supports reading the
client_id
andclient_secret
fields from the JSON, a_convert
method, which converts theprivate_key
field to theclient_id
andclient_secret
fields, is added toAuthenticationOauth2
. Then, users can specify the base64 encoded value in theprivate_key
field.Since the current workflow already uses a
tokenSecretKey
config for JWT authentication and this secret key cannot be used to verify the OAuth2 access token, a docker-compose YAML file is added to set up another Pulsar standalone with OAuth2 authentication configured.oauth2_test.py
is added to run against this separated cluster.