Skip to content

Add redis_auth_username support to misk-redis-lettuce#3635

Open
davidjoyceAfterpay wants to merge 4 commits intocashapp:masterfrom
davidjoyceAfterpay:djoyce/misk-redis-lettuce-username
Open

Add redis_auth_username support to misk-redis-lettuce#3635
davidjoyceAfterpay wants to merge 4 commits intocashapp:masterfrom
davidjoyceAfterpay:djoyce/misk-redis-lettuce-username

Conversation

@davidjoyceAfterpay
Copy link
Collaborator

@davidjoyceAfterpay davidjoyceAfterpay commented Jan 22, 2026

Summary

Redis 6.0+ introduced ACL (Access Control List) with username+password authentication. AWS ElastiCache with Redis ACL enabled requires both username and password for authentication, but misk-redis-lettuce only supported password-only auth.

This PR adds:

  • Optional redis_auth_username field to RedisReplicationGroupConfig (standalone Redis)
  • Optional redis_auth_username field to RedisClusterGroupConfig (Redis Cluster)
  • Uses Lettuce's withAuthentication(username, password) when username is provided
  • Falls back to withPassword(password) when username is null (backwards compatible)

Example Configuration

redis_cluster:
  my-cluster:
    configuration_endpoint:
      hostname: "master.my-cluster.cache.amazonaws.com"
      port: 6379
    redis_auth_password: "${REDIS_AUTH_PASSWORD}"
    redis_auth_username: "${REDIS_AUTH_USERNAME}"  # New optional field
    use_ssl: true

🤖 Generated with Claude Code

davidjoyceAfterpay and others added 2 commits January 23, 2026 10:44
Redis 6.0+ introduced ACL with username+password authentication via the
AUTH command. AWS ElastiCache with Redis ACL enabled requires both
username and password for authentication.

This change adds optional redis_auth_username field to:
- RedisReplicationGroupConfig (standalone Redis)
- RedisClusterGroupConfig (Redis Cluster)

When username is provided, the Lettuce client uses withAuthentication()
instead of withPassword() to pass both credentials. This is backwards
compatible - when username is null, the existing password-only auth
continues to work.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Tests verify that:
- RedisReplicationGroupConfig accepts redis_auth_username
- RedisClusterGroupConfig accepts redis_auth_username
- Username defaults to null when not provided (backwards compatible)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@davidjoyceAfterpay davidjoyceAfterpay marked this pull request as ready for review January 22, 2026 23:55
Copy link
Collaborator

@jvmakine jvmakine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

Copy link
Collaborator

@adrw adrw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG

@adrw adrw enabled auto-merge January 23, 2026 04:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants