Add WebSocket authentication via api_key
- When --api_key is set, WebSocket connections require auth too - Supports Authorization: Bearer <key> header or ?token=<key> query param - Unauthenticated connections receive HTTP 401 before upgrade - Uses websockets process_request callback (no resource allocation before auth) - Added 5 unit tests for WebSocket auth handler
This commit is contained in:
+2
-2
@@ -100,8 +100,8 @@ if __name__ == "__main__":
|
||||
'--api_key',
|
||||
type=str,
|
||||
default=None,
|
||||
help='Optional API key for authenticating REST API requests. '
|
||||
'Clients must send "Authorization: Bearer <key>" header.'
|
||||
help='Optional API key for authenticating REST API and WebSocket connections. '
|
||||
'Clients must send "Authorization: Bearer <key>" header or "?token=<key>" query parameter.'
|
||||
)
|
||||
parser.add_argument(
|
||||
'--rate_limit_rpm',
|
||||
|
||||
Reference in New Issue
Block a user