Skip to content

Conversation

@michaeljmarshall
Copy link
Member

@michaeljmarshall michaeljmarshall commented Mar 31, 2023

Motivation

The current function worker interfaces introduced by #8560 are hard to extend. It is better to pass an object that we can add fields to as needed.

Modifications

  • Introduce a new AuthenticationParameters class to wrap all of the relevant authentication "data". This class is somewhat unfortunate in that we already have many classes that hold authentication information. However, my goal with this class is to wrap all of the relevant auth info. This class is only currently used in the Function Worker API, but I plan to add it to the rest of the Admin HTTP endpoints.
  • Add proxyRoles setting to function worker.

Verifying this change

There are tests to cover the changes.

Documentation

  • doc

This change has Javadoc updates to document the changes.

Matching PR in forked repository

PR in forked repository: michaeljmarshall#37

@michaeljmarshall michaeljmarshall added doc Your PR contains doc changes, no matter whether the changes are in markdown or code files. area/function area/admin labels Mar 31, 2023
@michaeljmarshall michaeljmarshall added this to the 3.0.0 milestone Mar 31, 2023
@michaeljmarshall michaeljmarshall self-assigned this Mar 31, 2023
@michaeljmarshall
Copy link
Member Author

@lhotari - thanks for your review. I've refactored things a bit more. Would you take another look? Thanks!

@michaeljmarshall michaeljmarshall merged commit 55acbe6 into apache:master Apr 7, 2023
@michaeljmarshall michaeljmarshall deleted the refactor-fn-auth branch April 7, 2023 17:21
michaeljmarshall added a commit that referenced this pull request Apr 8, 2023
…19975)

The current function worker interfaces introduced by #8560 are hard to extend. It is better to pass an object that we can add fields to as needed.

* Introduce a new `Authentication` class to wrap all of the relevant authentication "data". This class is somewhat unfortunate in that we already have many classes that hold authentication information. However, my goal with this class is to wrap all of the relevant auth info. This class is only currently used in the Function Worker API, but I plan to add it to the rest of the Admin HTTP endpoints.
* Deprecate all of the methods that are no longer needed. Add a default implementation to call the new methods that supersede those methods.
* Add `proxyRoles` setting to function worker.

There are tests to cover the changes.

This PR changes several interfaces in completely backwards compatible ways. It's possible we'll want to improve the abstraction for the `Authentication` class by making it an interface.

- [x] `doc`

This change has Javadoc updates to document the changes.

PR in forked repository: michaeljmarshall#37

(cherry picked from commit 55acbe6)
michaeljmarshall added a commit to michaeljmarshall/pulsar that referenced this pull request Apr 8, 2023
…pache#19975)

The current function worker interfaces introduced by apache#8560 are hard to extend. It is better to pass an object that we can add fields to as needed.

* Introduce a new `Authentication` class to wrap all of the relevant authentication "data". This class is somewhat unfortunate in that we already have many classes that hold authentication information. However, my goal with this class is to wrap all of the relevant auth info. This class is only currently used in the Function Worker API, but I plan to add it to the rest of the Admin HTTP endpoints.
* Deprecate all of the methods that are no longer needed. Add a default implementation to call the new methods that supersede those methods.
* Add `proxyRoles` setting to function worker.

There are tests to cover the changes.

This PR changes several interfaces in completely backwards compatible ways. It's possible we'll want to improve the abstraction for the `Authentication` class by making it an interface.

- [x] `doc`

This change has Javadoc updates to document the changes.

PR in forked repository: #37

(cherry picked from commit 55acbe6)
(cherry picked from commit 54c97ad)
michaeljmarshall added a commit to michaeljmarshall/pulsar that referenced this pull request Apr 8, 2023
…pache#19975)

The current function worker interfaces introduced by apache#8560 are hard to extend. It is better to pass an object that we can add fields to as needed.

* Introduce a new `Authentication` class to wrap all of the relevant authentication "data". This class is somewhat unfortunate in that we already have many classes that hold authentication information. However, my goal with this class is to wrap all of the relevant auth info. This class is only currently used in the Function Worker API, but I plan to add it to the rest of the Admin HTTP endpoints.
* Deprecate all of the methods that are no longer needed. Add a default implementation to call the new methods that supersede those methods.
* Add `proxyRoles` setting to function worker.

There are tests to cover the changes.

This PR changes several interfaces in completely backwards compatible ways. It's possible we'll want to improve the abstraction for the `Authentication` class by making it an interface.

- [x] `doc`

This change has Javadoc updates to document the changes.

PR in forked repository: #37

(cherry picked from commit 55acbe6)
(cherry picked from commit 54c97ad)
(cherry picked from commit cf40926)
michaeljmarshall added a commit that referenced this pull request Apr 10, 2023
…0046)

### Motivation

In #19975, we introduced a wrapper for all authentication parameters. This PR adds that wrapper to the Rest Producer.

### Modifications

* Use `AuthenticationParameters` to simplify parameter management in Rest Producer.
* Add method to the `AuthorizationService` that takes the `AuthenticationParameters`.
* Update annotations on Rest Producer to indicate that a 401 is an expected response.

### Verifying this change

This change is covered by the `TopicsAuthTest`.

### Documentation

- [x] `doc-not-needed` 

This is an internal change that does not need to be documented.

### Matching PR in forked repository

PR in forked repository: skipping PR since the relevant tests pass locally
michaeljmarshall added a commit that referenced this pull request Apr 10, 2023
…0046)

In #19975, we introduced a wrapper for all authentication parameters. This PR adds that wrapper to the Rest Producer.

* Use `AuthenticationParameters` to simplify parameter management in Rest Producer.
* Add method to the `AuthorizationService` that takes the `AuthenticationParameters`.
* Update annotations on Rest Producer to indicate that a 401 is an expected response.

This change is covered by the `TopicsAuthTest`.

- [x] `doc-not-needed`

This is an internal change that does not need to be documented.

PR in forked repository: skipping PR since the relevant tests pass locally

(cherry picked from commit 7990948)
michaeljmarshall added a commit that referenced this pull request Apr 10, 2023
…0046)

In #19975, we introduced a wrapper for all authentication parameters. This PR adds that wrapper to the Rest Producer.

* Use `AuthenticationParameters` to simplify parameter management in Rest Producer.
* Add method to the `AuthorizationService` that takes the `AuthenticationParameters`.
* Update annotations on Rest Producer to indicate that a 401 is an expected response.

This change is covered by the `TopicsAuthTest`.

- [x] `doc-not-needed`

This is an internal change that does not need to be documented.

PR in forked repository: skipping PR since the relevant tests pass locally

(cherry picked from commit 7990948)
(cherry picked from commit 02b27e8)
michaeljmarshall added a commit that referenced this pull request Apr 10, 2023
…0046)

In #19975, we introduced a wrapper for all authentication parameters. This PR adds that wrapper to the Rest Producer.

* Use `AuthenticationParameters` to simplify parameter management in Rest Producer.
* Add method to the `AuthorizationService` that takes the `AuthenticationParameters`.
* Update annotations on Rest Producer to indicate that a 401 is an expected response.

This change is covered by the `TopicsAuthTest`.

- [x] `doc-not-needed`

This is an internal change that does not need to be documented.

PR in forked repository: skipping PR since the relevant tests pass locally

(cherry picked from commit 7990948)
(cherry picked from commit 02b27e8)
Demogorgon314 pushed a commit to Demogorgon314/pulsar that referenced this pull request Apr 11, 2023
…ache#20046)

### Motivation

In apache#19975, we introduced a wrapper for all authentication parameters. This PR adds that wrapper to the Rest Producer.

### Modifications

* Use `AuthenticationParameters` to simplify parameter management in Rest Producer.
* Add method to the `AuthorizationService` that takes the `AuthenticationParameters`.
* Update annotations on Rest Producer to indicate that a 401 is an expected response.

### Verifying this change

This change is covered by the `TopicsAuthTest`.

### Documentation

- [x] `doc-not-needed` 

This is an internal change that does not need to be documented.

### Matching PR in forked repository

PR in forked repository: skipping PR since the relevant tests pass locally
michaeljmarshall added a commit to datastax/pulsar that referenced this pull request Apr 11, 2023
…pache#19975)

The current function worker interfaces introduced by apache#8560 are hard to extend. It is better to pass an object that we can add fields to as needed.

* Introduce a new `Authentication` class to wrap all of the relevant authentication "data". This class is somewhat unfortunate in that we already have many classes that hold authentication information. However, my goal with this class is to wrap all of the relevant auth info. This class is only currently used in the Function Worker API, but I plan to add it to the rest of the Admin HTTP endpoints.
* Deprecate all of the methods that are no longer needed. Add a default implementation to call the new methods that supersede those methods.
* Add `proxyRoles` setting to function worker.

There are tests to cover the changes.

This PR changes several interfaces in completely backwards compatible ways. It's possible we'll want to improve the abstraction for the `Authentication` class by making it an interface.

- [x] `doc`

This change has Javadoc updates to document the changes.

PR in forked repository: michaeljmarshall#37

(cherry picked from commit 55acbe6)
michaeljmarshall added a commit to datastax/pulsar that referenced this pull request Apr 11, 2023
…ache#20046)

In apache#19975, we introduced a wrapper for all authentication parameters. This PR adds that wrapper to the Rest Producer.

* Use `AuthenticationParameters` to simplify parameter management in Rest Producer.
* Add method to the `AuthorizationService` that takes the `AuthenticationParameters`.
* Update annotations on Rest Producer to indicate that a 401 is an expected response.

This change is covered by the `TopicsAuthTest`.

- [x] `doc-not-needed`

This is an internal change that does not need to be documented.

PR in forked repository: skipping PR since the relevant tests pass locally

(cherry picked from commit 7990948)
(cherry picked from commit 02b27e8)
@freeznet
Copy link
Contributor

@michaeljmarshall I noticed that this PR changed the interface of the functions worker's API, such changes should be avoided to cherry-pick into the historical branches.
As for the APIs changes, it requires a PIP first, then adopting the implementation to the codebase, see https://github.com/apache/pulsar/blob/master/wiki/proposals/PIP.md#when-is-a-pip-required. It should be better to revert this PR first, send the PIP to the community, and then get the implementation to the codebase, WDYT?

@eolivelli
Copy link
Contributor

This is not strictly a public API change, it is more like fixing a security issue.
Nobody is expected to implement these interfaces.

@codelipenghui
Copy link
Contributor

@freeznet I have forward the email under the private mailing list to your apache email, so that you can get all the context about the changes.

@michaeljmarshall
Copy link
Member Author

This actually made it into 2.10.4.

@michaeljmarshall
Copy link
Member Author

As discussed on the mailing list https://lists.apache.org/thread/w4jzk27qhtosgsz7l9bmhf1t7o9mxjhp, there is no plan to release 2.9.6, so I am going to remove the release/2.9.6 label

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/admin area/function cherry-picked/branch-2.9 Archived: 2.9 is end of life cherry-picked/branch-2.10 cherry-picked/branch-2.11 doc Your PR contains doc changes, no matter whether the changes are in markdown or code files. ready-to-test release/2.10.4 release/2.11.1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants