feat: add tls and api key authentication support

Merged
VI
8mo ago
+808-5

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 verification
  • withTlsClientCert() for mTLS
  • withApiKey() for Bearer token auth via ApiKeyInterceptor
  • 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 via ApiKeyInterceptor)
    • Uses io.grpc.TlsChannelCredentials; sends API key in authorization metadata on every RPC
    • withTlsCaCert() implies TLS; withTls() uses the JVM default trust store
    • proto/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 FilaException to avoid breaking callers
    • Catch IllegalArgumentException from TLS trust manager for invalid certs
    • Parse host/port before TLS setup; support IPv6 bracket addresses
    • Fix TLS-only test to assert UNAUTHENTICATED without an API key
    • Revert PATH-based binary lookup to keep TLS tests skipped in CI until infra is ready
    • Apply spotless formatting