mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
ElastiCacheAuthProxy and MemoryDbAuthProxy each implemented their own copy of the RESP AUTH handshake, accept loop, and client/backend relay, ~87 duplicated lines flagged by CPD. MemoryDB's proxy is modeled on ElastiCache's (same wire protocol, same IAM-auth mechanism), so both now extend AbstractRedisAuthProxy, which owns the shared accept/handshake/relay plumbing behind two small hooks (authRequired, authenticate) that each subclass implements against its own validators. No behavior change: closeQuietly stays per-subclass since the two implementations genuinely differ (ElastiCache shuts down the socket's output side and logs at debug; MemoryDB just closes), and every other extracted method reproduces the original logic byte for byte. Also adds integration coverage for a path that existed before this refactor but had no automated test either way: a client that sends an explicit AUTH command on a connection where auth isn't required must still get +OK and stay usable, rather than being rejected.