Skip to content

Add support for Redis 6 authentication with username #22702

@mp911de

Description

@mp911de

Redis 6 finally brings full ACL support by accepting a username in addition to the already existing password.

It would make sense to support the authentication method with two configuration properties:

  • spring.redis.username (bound to RedisStandaloneConfiguration and RedisClusterConfiguration)
  • spring.redis.sentinel.username (bound to RedisSentinelConfiguration)

The username can be supported in every place where password is used. This feature should be backward-compatible so authentication without a username is supported, too (e.g. for older Redis server versions). In that case, Redis…Configuration.setUserName(…) isn't called.

URL-based configuration should be adopted accordingly and we should ideally log a warning that the form redis://foobar@host is deprecated as foobar is considered to be the password. From a proper URL syntax perspective, the userinfo part should consist of a username and password delimited by a colon. So a URI with an empty username should be rendered as redis://:foobar@host to avoid ambiguity.

The setting is supported by both Redis clients (Lettuce and Jedis).

Spring Data Redis needs to implement DATAREDIS-1046 first before this ticket can be addressed.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions