Add HTTP authentication support for connectors and listeners#405
Merged
Add HTTP authentication support for connectors and listeners#405
Conversation
This commit implements HTTP Basic Authentication for both HTTP connectors (upstream proxy authentication) and HTTP listeners (client authentication). ## Features Added ### HTTP Connectors (Outbound Authentication) - Add HttpAuthData struct with username/password fields - Update HttpConnectorConfig to include optional auth field - Modify http_forward_proxy_connect() to add Proxy-Authorization header - Support authentication for both CONNECT tunneling and HTTP forward proxy modes ### HTTP Listeners (Inbound Authentication) - Update HttpListenerConfig to include AuthData field - Modify http_forward_proxy_handshake() to parse and validate auth headers - Integration with existing AuthData validation system - Return 407 Proxy Authentication Required for failed authentication ### QUIC Integration - Update QUIC connectors to pass auth parameter (None for compatibility) - Update QUIC listeners to support authentication using AuthData system ## Technical Implementation - HTTP Basic Authentication with proper base64 encoding/decoding - Support for both Proxy-Authorization and Authorization headers - Backward compatible - all auth fields are optional - Comprehensive test coverage including auth functionality - All 71 existing tests continue to pass ## Dependencies - Add base64 crate for proper credential encoding 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements HTTP Basic Authentication support for both HTTP connectors (upstream proxy authentication) and HTTP listeners (client authentication), providing comprehensive authentication capabilities for the redproxy-rs proxy server.
Key Features
🔗 HTTP Connectors (Outbound Authentication)
HttpAuthDatastruct with username and password fieldsHttpConnectorConfigto include optionalauthfieldhttp_forward_proxy_connect()to addProxy-Authorization: Basic <credentials>header🛡️ HTTP Listeners (Inbound Authentication)
HttpListenerConfigto includeAuthDatafield (following existing SOCKS pattern)http_forward_proxy_handshake()to parse and validateProxy-Authorization/AuthorizationheadersAuthDatavalidation system (supports both static users and command-based auth)⚡ QUIC Integration
AuthDatasystemTechnical Implementation
Basic <base64(username:password)>encodingConfiguration Examples
HTTP Connector with Authentication:
HTTP Listener with Authentication:
Test Plan
Dependencies
base64crate for proper credential encoding🤖 Generated with Claude Code