Determine Correct Expansion of AuthenticationProvider interface for WebSocket Proxy
- Dominant language
- Java
- Stars
- 15.3k
- Forks
- 3.8k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 160
Description
## Problem
The current `AuthenticationProvider` interface has the following method:
https://github.com/apache/pulsar/blob/fb7f14ceb04d612e456b2e5a834385ae3a97f68f/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationProvider.java#L158-L174
The `HttpServletResponse` appears to have been introduced for multi-stage http authentication, which is only used by the `AuthenticationProviderSasl`:
https://github.com/apache/pulsar/blob/82237d3684fe506bcb6426b3b23f413422e6e4fb/pulsar-broker-auth-sasl/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationProviderSasl.java#L229-L313
However, the WebSocket Proxy does not have access to an `HttpServletResponse`. It only has access to a `ServletUpgradeResponse`, as seen here:
https://github.com/apache/pulsar/blob/516437e370a711d48fe1d444a0c47e64e7cf2f4b/pulsar-websocket/src/main/java/org/apache/pulsar/websocket/AbstractWebSocketHandler.java#L91-L122
Therefore, the current API does not allow for multi-phased http authentication.
## Observations
`ServletUpgradeResponse` is a wrapper for `HttpServletResponse`, but it doesn't provide direct access. Does that mean we should add a new method to the `AuthenticationProvider` interface just for the WebSocket?
For now, the current state is that multi-stage auth is not supported in the WebSocket proxy. This technically aligns with the current limitation that multi-stage auth is not available in the regular pulsar proxy #19291.
Contributor guide
Research direction
Read AuthenticationProvider.java and AuthenticationProviderSasl.java to understand why HttpServletResponse is part of the interface. Then inspect AbstractWebSocketHandler.java and its ServletUpgradeResponse usage, and compare the limitation described in issue #19291. Done means establishing and documenting the correct interface direction for multi-stage authentication in the WebSocket proxy.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, authentication
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100