feat: add tls and api key authentication support
Merged
VI
8mo ago+808+808+012345678901234567890123456789-5-5-0123456789
Summary
Add TLS and API key authentication support to the Java SDK, achieving feature parity with the Rust SDK (Epic 15).
withTlsCaCert()for server-side TLS verificationwithTlsClientCert()for mTLSwithApiKey()for Bearer token auth viaApiKeyInterceptor- Backward compatible: no auth options = same behavior as before
Test plan
- Unit tests pass (builder, invalid cert handling)
- Integration tests pass with TLS+auth-enabled fila-server
- Auth rejection test validates UNAUTHENTICATED response
🤖 Generated with Claude Code
Summary by cubic
Adds TLS (system trust, custom CA, and mTLS) and API key auth to the Java SDK so clients can connect securely and authenticate. Backward compatible: without options, the client still uses plaintext with no auth.
-
New Features
FilaClient.Builder:withTls(),withTlsCaCert(byte[]),withTlsClientCert(byte[], byte[]),withApiKey(String)(Bearer viaApiKeyInterceptor)- Uses
io.grpc.TlsChannelCredentials; sends API key inauthorizationmetadata on every RPC withTlsCaCert()implies TLS;withTls()uses the JVM default trust storeproto/fila/v1/admin.proto: Create/Revoke/List API keys, Set/Get ACL; added cluster fields to stats and queue info- README examples for system trust, custom CA, mTLS, and API keys; unit and integration tests for TLS + auth
-
Bug Fixes
- Fail fast when a client cert is provided without TLS; keep throwing
FilaExceptionto avoid breaking callers - Catch
IllegalArgumentExceptionfrom TLS trust manager for invalid certs - Parse host/port before TLS setup; support IPv6 bracket addresses
- Fix TLS-only test to assert
UNAUTHENTICATEDwithout an API key - Revert PATH-based binary lookup to keep TLS tests skipped in CI until infra is ready
- Apply
spotlessformatting
- Fail fast when a client cert is provided without TLS; keep throwing