codelipenghui opened a new pull request, #24615:
URL: https://github.com/apache/pulsar/pull/24615

   ## Motivation
   
   When the broker has `authenticateOriginalAuthData` enabled, WebSocket proxy 
connections were failing with authentication errors:
   
   ```
   Failed to authenticate: operation=connect, principal=null, reason=No 
anonymous role, and can't find AuthenticationProvider for original role using 
auth method [none] is not available
   ```
   
   This happened because the broker was trying to authenticate the 
`WEBSOCKET_DUMMY_ORIGINAL_PRINCIPLE` as if it were real original authentication 
data.
   
   ## Modifications
   
   - Modified `ServerCnx.handleConnect()` to skip original authentication when 
the originalPrincipal is the WebSocket dummy value 
(`WEBSOCKET_DUMMY_ORIGINAL_PRINCIPLE`)
   - Added test `ProxyRoleAuthenticateOriginalAuthDataTest` that extends 
`ProxyRoleAuthTest` with `authenticateOriginalAuthData` enabled
   - Added test `ProxyRoleAuthenticateOriginalAuthDataWebServiceURLTest` that 
tests the WebService URL variant
   
   ## Verifying this change
   
   - [x] Make sure that the change passes the CI checks.
   
   The new tests `ProxyRoleAuthenticateOriginalAuthDataTest` reproduce the 
issue and verify the fix works correctly.
   
   ## Test plan
   
   Run the new test:
   ```bash
   mvn test -Dtest=ProxyRoleAuthenticateOriginalAuthDataTest -pl pulsar-broker 
-Dgroups=websocket
   ```
   
   🤖 Generated with [Claude Code](https://claude.ai/code)


-- 
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: commits-unsubscr...@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to