michaeljmarshall opened a new pull request #12104:
URL: https://github.com/apache/pulsar/pull/12104


   Master Issue: 
   
   ### Motivation
   
   As the first part of PIP-97, we need to update the interfaces. This PR is 
the only PR that will update interfaces. It should not introduce any breaking 
changes.
   
   ### Modifications
   
   #### AuthenticationProvider
   
   * Add `AuthenticationProvider#authenticateAsync`. Include a default 
implementation that calls the `authenticate` method. Note that current 
implementations should all be non-blocking, so there is no need to push the 
execution to a separate thread.
   * Deprecate `AuthenticationProvider#authenticate`.
   * Add `AuthenticationProvider#authenticateHttpRequestAsync`. This method is 
complicated. It is only called when using the SASL authentication provider 
(this is hard coded into the Pulsar code base). As such, I would argue that it 
is worth removing support for this unreachable method and then refactor the 
SASL authentication provider. I annotated this method with 
`@InterfaceStability.Unstable` and added details to the Javadoc in order to 
communicate the uncertainty of this method's future. I am happy to discuss this 
in more detail though.
   * Deprecate `AuthenticationProvider#authenticateHttpRequest`.
   
   #### AuthenticationState
   
   * Add `AuthenticationState#authenticateAsync`. Include a default 
implementation that calls the `authenticate` method and then performs a check 
to determine what result to return. Note that current implementations should 
all be non-blocking, so there is no need to push the execution to a separate 
thread.
   * Deprecate `AuthenticationState#authenticate`. The preferred method is 
`AuthenticationState#authenticateAsync`.
   * Deprecate `AuthenticationState#isComplete`. This method can be avoided by 
inferring authentication completeness from the result of 
`AuthenticationState#authenticateAsync`. When the result is `null`, auth is 
complete. When it is not `null`, auth is not complete. Since the result of the 
`authenticateAsync` method is the body delivered to the client, this seems like 
a reasonable abstraction to make. As a consequence, the `AuthenticationState` 
is simpler and also avoids certain thread safety issues that might arise when 
calling `isComplete` from a different thread.
   
   #### AuthenticationDataSource
   * Deprecate `AuthenticationDataSource#authenticate`. This method is not 
called by the Pulsar authentication framework. This needs to be deprecated to 
prevent confusion for end users seeking to extend the authentication framework. 
There is no need for an async version of this method.
   
   ### Verifying this change
   
   These changes only affect the interfaces. I will need to add tests to verify 
the correctness of the default implementations in this PR.
   
   ### Does this pull request potentially affect one of the following parts:
   
   Yes, it affects the public API. That is why it has a PIP.
   
   ### Documentation
   I've updated the Javadocs. There is not any current documentation on 
implementing your own authentication provider, so I think updating Javadocs is 
sufficient documentation, for now.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to