Skip to content

Conversation

@jiazhai
Copy link
Member

@jiazhai jiazhai commented Jul 1, 2020

Motivation

Pulsar supports authenticating clients using OAuth 2.0 access tokens. You can use tokens to identify a Pulsar client and associate with some "principal" (or "role") that is permitted to do some actions (eg: publish to a topic or consume from a topic).

This module is to support Pulsar Client Authentication Plugin for OAuth 2.0 directly. Client side communicate with Oauth 2.0 server, then the client will get an access token from Oauth 2.0 server, and will pass this access token to Pulsar broker to do the authentication.

So the Broker side could still use org.apache.pulsar.broker.authentication.AuthenticationProviderToken,
also user can add their own AuthenticationProvider to work with this module.

Modifications

  • add related code;
  • add related test;
  • add related doc.

The init of this client authentication module would be like:

Authentication oauth2Authentication = AuthenticationFactoryOAuth2.clientCredentials(
                new URL("https://dev-kt-aa9ne.us.auth0.com/oauth/token"),
                new URL("file:///path/to/credential/file.json"),  // key file path
                "https://dev-kt-aa9ne.us.auth0.com/api/v2/"
        );
PulsarClient client = PulsarClient.builder()
    .serviceUrl("pulsar://broker.example.com:6650/")
    .authentication(oauth2Authentication)
    .build();

Verifying this change

tests passed.

@jiazhai jiazhai added area/security doc-required Your PR changes impact docs and you will update later. labels Jul 1, 2020
@jiazhai jiazhai added this to the 2.7.0 milestone Jul 1, 2020
@jiazhai jiazhai requested review from sijie and tuteng July 1, 2020 15:46
@jiazhai jiazhai self-assigned this Jul 1, 2020
@jiazhai jiazhai requested a review from codelipenghui July 2, 2020 00:14
@jiazhai
Copy link
Member Author

jiazhai commented Jul 2, 2020

/pulsarbot run-failure-checks

@jiazhai
Copy link
Member Author

jiazhai commented Jul 2, 2020

/pulsarbot run-failure-checks

Copy link
Member

@sijie sijie left a comment

Choose a reason for hiding this comment

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

overall looks good! a small comment is to move the documentation to the website.

@@ -0,0 +1,94 @@
# Pulsar Client Authentication Plugin for OAuth 2.0
Copy link
Member

Choose a reason for hiding this comment

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

@jiazhai Can you move this README to the website documentation?

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks @sijie, already marked it as doc-required. will provide another Pr to refine the doc.

@jiazhai jiazhai merged commit 768813e into apache:master Jul 2, 2020
@jiazhai jiazhai mentioned this pull request Jul 7, 2020
jiazhai added a commit that referenced this pull request Jul 9, 2020
### Motivation

#7420 provides an Oauth2 auth client for java. This PR tries to support it in cpp client

### Modifications

- add implementation
- add related tests.
jiazhai pushed a commit that referenced this pull request Jul 9, 2020
fixes #7425 

### Motivation
Pulsar supports authenticating clients using OAuth 2.0 access tokens. the related code is updated as shown in this PR: #7420.

Update the related pulsar doc.



### Modifications
In security section: add Authentication using OAuth 2.0 access tokens
Java client: add an example about Oauth authentication
sidebar: update the sidebar document.
wolfstudy pushed a commit that referenced this pull request Jul 29, 2020
…#7420)

### Motivation

Pulsar supports authenticating clients using OAuth 2.0 access tokens. You can use tokens to identify a Pulsar client and associate with some "principal" (or "role") that is permitted to do some actions (eg: publish to a topic or consume from a topic). 

This module is to support Pulsar Client Authentication Plugin for OAuth 2.0 directly. Client side communicate with Oauth 2.0 server,  then the client will get an `access token` from Oauth 2.0 server, and will pass this `access token` to Pulsar broker to do the authentication.

So the Broker side could still use `org.apache.pulsar.broker.authentication.AuthenticationProviderToken`,
also user can add their own `AuthenticationProvider` to work with this module.

### Modifications

- add related code;
- add related test;
- add related doc.

The init of this client authentication module would be like:
```java
Authentication oauth2Authentication = AuthenticationFactoryOAuth2.clientCredentials(
                new URL("https://dev-kt-aa9ne.us.auth0.com/oauth/token"),
                new URL("file:///path/to/credential/file.json"),  // key file path
                "https://dev-kt-aa9ne.us.auth0.com/api/v2/"
        );
PulsarClient client = PulsarClient.builder()
    .serviceUrl("pulsar://broker.example.com:6650/")
    .authentication(oauth2Authentication)
    .build();
```

### Verifying this change

tests passed.

(cherry picked from commit 768813e)
wolfstudy pushed a commit that referenced this pull request Jul 29, 2020
fixes #7425 

### Motivation
Pulsar supports authenticating clients using OAuth 2.0 access tokens. the related code is updated as shown in this PR: #7420.

Update the related pulsar doc.



### Modifications
In security section: add Authentication using OAuth 2.0 access tokens
Java client: add an example about Oauth authentication
sidebar: update the sidebar document.

(cherry picked from commit 6726072)
wolfstudy pushed a commit that referenced this pull request Jul 29, 2020
### Motivation

#7420 provides an Oauth2 auth client for java. This PR tries to support it in cpp client

### Modifications

- add implementation
- add related tests.

(cherry picked from commit 2d0cceb)
huangdx0726 pushed a commit to huangdx0726/pulsar that referenced this pull request Aug 24, 2020
…apache#7420)

### Motivation

Pulsar supports authenticating clients using OAuth 2.0 access tokens. You can use tokens to identify a Pulsar client and associate with some "principal" (or "role") that is permitted to do some actions (eg: publish to a topic or consume from a topic). 

This module is to support Pulsar Client Authentication Plugin for OAuth 2.0 directly. Client side communicate with Oauth 2.0 server,  then the client will get an `access token` from Oauth 2.0 server, and will pass this `access token` to Pulsar broker to do the authentication.

So the Broker side could still use `org.apache.pulsar.broker.authentication.AuthenticationProviderToken`,
also user can add their own `AuthenticationProvider` to work with this module.

### Modifications

- add related code;
- add related test;
- add related doc.

The init of this client authentication module would be like:
```java
Authentication oauth2Authentication = AuthenticationFactoryOAuth2.clientCredentials(
                new URL("https://dev-kt-aa9ne.us.auth0.com/oauth/token"),
                new URL("file:///path/to/credential/file.json"),  // key file path
                "https://dev-kt-aa9ne.us.auth0.com/api/v2/"
        );
PulsarClient client = PulsarClient.builder()
    .serviceUrl("pulsar://broker.example.com:6650/")
    .authentication(oauth2Authentication)
    .build();
```

### Verifying this change

tests passed.
huangdx0726 pushed a commit to huangdx0726/pulsar that referenced this pull request Aug 24, 2020
### Motivation

apache#7420 provides an Oauth2 auth client for java. This PR tries to support it in cpp client

### Modifications

- add implementation
- add related tests.
huangdx0726 pushed a commit to huangdx0726/pulsar that referenced this pull request Aug 24, 2020
fixes apache#7425 

### Motivation
Pulsar supports authenticating clients using OAuth 2.0 access tokens. the related code is updated as shown in this PR: apache#7420.

Update the related pulsar doc.



### Modifications
In security section: add Authentication using OAuth 2.0 access tokens
Java client: add an example about Oauth authentication
sidebar: update the sidebar document.
@Anonymitaet Anonymitaet added doc-complete Your PR changes impact docs and the related docs have been already added. and removed doc-required Your PR changes impact docs and you will update later. labels Feb 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/security doc-complete Your PR changes impact docs and the related docs have been already added. release/2.6.1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants