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

Add oauth2 examples for repo #21

Merged
merged 12 commits into from
Aug 3, 2020
Merged

Conversation

wolfstudy
Copy link
Contributor

Signed-off-by: xiaolong.ran [email protected]

Add oauth2 examples for repo

Signed-off-by: xiaolong.ran <[email protected]>
@wolfstudy wolfstudy requested a review from a team as a code owner July 28, 2020 05:53
@wolfstudy wolfstudy self-assigned this Jul 28, 2020
@sijie
Copy link
Member

sijie commented Jul 28, 2020

@jennifer88huang @Huanli-Meng Can you please review this pull request?

@Jennifer88huang-zz
Copy link

sure.

Copy link
Contributor

@Huanli-Meng Huanli-Meng left a comment

Choose a reason for hiding this comment

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

leave my comments, PTAL.

cloud/README.md Outdated Show resolved Hide resolved
cloud/README.md Outdated Show resolved Hide resolved
cloud/README.md Outdated Show resolved Hide resolved
cloud/README.md Outdated Show resolved Hide resolved
cloud/README.md Outdated Show resolved Hide resolved
cloud/README.md Outdated Show resolved Hide resolved
cloud/README.md Outdated Show resolved Hide resolved
cloud/README.md Outdated Show resolved Hide resolved
cloud/README.md Outdated Show resolved Hide resolved
Signed-off-by: xiaolong.ran <[email protected]>
@wolfstudy
Copy link
Contributor Author

@Huanli-Meng PTAL again thanks

Copy link
Contributor

@Huanli-Meng Huanli-Meng left a comment

Choose a reason for hiding this comment

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

Just one minor comment.

cloud/README.md Outdated Show resolved Hide resolved
Copy link

@Jennifer88huang-zz Jennifer88huang-zz left a comment

Choose a reason for hiding this comment

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

When you @wolfstudy finish other part, feel free to ping us.

cloud/README.md Outdated Show resolved Hide resolved
cloud/cpp/connectByOAuth2.cc Outdated Show resolved Hide resolved
@jiazhai
Copy link
Contributor

jiazhai commented Jul 31, 2020

@wolfstudy Please provide more detailed examples as other projects, not only connections.

Signed-off-by: xiaolong.ran <[email protected]>
Signed-off-by: xiaolong.ran <[email protected]>
Signed-off-by: xiaolong.ran <[email protected]>
Signed-off-by: xiaolong.ran <[email protected]>
Signed-off-by: xiaolong.ran <[email protected]>
Signed-off-by: xiaolong.ran <[email protected]>
@wolfstudy
Copy link
Contributor Author

Currently, the oauth2 examples of Go and Java are done, and cpp client example is providing.

@jiazhai @Huanli-Meng PTAL thanks

Signed-off-by: xiaolong.ran <[email protected]>
Copy link
Contributor

@Huanli-Meng Huanli-Meng left a comment

Choose a reason for hiding this comment

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

Leave my comments, PTAL.

Based on my understanding, I think the code example should include these parts:
1: authenticate the client use the Oauth ot token (./bin/snctl auth export-service-account instance-name -n namespace-name)(./bin/snctl auth get-token instance-name -n namespace-name).
2: set the token or authentication options based on the obtained Json file or token.
3: create a client.
4: create a client producer to send messages.
5: create a client consumer to receive messages.

In addition to Pulsar clients, such as Java, go, cpp, you need to provide more example for python, node.js, websocket, and C#. and also pulsar CLI tools, such as pulsar-admin, pulsar-perf, pulsar-client, pulsarctl.

cloud/README.md Outdated
- Go
- CPP

For clients in other languages, you can connect via Token, reference to [here](https://pulsar.apache.org/docs/en/security-tls-transport/#client-configuration).
Copy link
Contributor

Choose a reason for hiding this comment

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

as i learned, this is not about TLS transport. it should use the token generated by snctl auth get-token. please help confirm with guangning.

cloud/README.md Outdated Show resolved Hide resolved
cloud/README.md Outdated Show resolved Hide resolved
cloud/README.md Outdated Show resolved Hide resolved
cloud/go/README.md Outdated Show resolved Hide resolved
cloud/java/README.md Outdated Show resolved Hide resolved
cloud/java/README.md Outdated Show resolved Hide resolved
cloud/java/README.md Outdated Show resolved Hide resolved
cloud/java/README.md Outdated Show resolved Hide resolved
cloud/java/README.md Outdated Show resolved Hide resolved
Copy link
Contributor

@jiazhai jiazhai left a comment

Choose a reason for hiding this comment

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

Please make the names aligned:
Publish/Receive
SampleConsumer/SampleProducer
Consumer/Producer

Signed-off-by: xiaolong.ran <[email protected]>
@wolfstudy
Copy link
Contributor Author

@jiazhai @Huanli-Meng comments have been fixed, PTAL done

@wolfstudy
Copy link
Contributor Author

wolfstudy commented Aug 3, 2020

In addition to Pulsar clients, such as Java, go, cpp, you need to provide more example for python, node.js, websocket, and C#. and also pulsar CLI tools, such as pulsar-admin, pulsar-perf, pulsar-client, pulsarctl.

@Huanli-Meng Yes, we can add other languages client in the next pull request. This pr will mainly track go, CPP and Java client. Will track the task in #22

@wolfstudy
Copy link
Contributor Author

Based on my understanding, I think the code example should include these parts:
1: authenticate the client use the Oauth ot token (./bin/snctl auth export-service-account instance-name -n namespace-name)(./bin/snctl auth get-token instance-name -n namespace-name).
2: set the token or authentication options based on the obtained Json file or token.
3: create a client.
4: create a client producer to send messages.
5: create a client consumer to receive messages.

Cool @Huanli-Meng This logic is correct, in [How to get OAuth2 options], we introduced how to get the specified options.

Copy link
Contributor

@Huanli-Meng Huanli-Meng left a comment

Choose a reason for hiding this comment

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

LGTM

@wolfstudy wolfstudy merged commit b6125b4 into master Aug 3, 2020
@wolfstudy wolfstudy deleted the xiaolong/add-oauth2-examples branch August 3, 2020 09:46
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

Successfully merging this pull request may close these issues.

5 participants