Skip to content

Commit 1901b6a

Browse files
committed
fix(redis-cluster): correctly pass username and password
### Summary Fixed a bug in redis-cluster connector where username and password authentication did not work properly (the authentication without username did work properly). The username and password authentication requires Kong fork of the redis-cluster library: https://github.com/Kong/resty-redis-cluster, and does not work with the: https://github.com/steve0511/resty-redis-cluster.
1 parent c980143 commit 1901b6a

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

Changes.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
All notable changes to `lua-resty-session` will be documented in this file.
44

5+
## [4.1.4] - 2025-08-11
6+
### Fixed
7+
- fix(redis-cluster): correctly pass username and password
8+
9+
510
## [4.1.3] - 2025-07-29
611
### Fixed
712
- fix(utils): disable the SP800-132 compliance checks (on FIPS mode, but doesn't violate FIPS)

lib/resty/session/redis/cluster.lua

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,12 @@ function storage.new(configuration)
207207
local ssl_verify = configuration and configuration.ssl_verify
208208
local server_name = configuration and configuration.server_name
209209

210+
210211
local auth
211-
if password then
212-
if username then
213-
auth = username .. " " .. password
214-
else
212+
if not username then
213+
if password then
215214
auth = password
215+
password = nil
216216
end
217217
end
218218

@@ -234,6 +234,8 @@ function storage.new(configuration)
234234
max_connection_attempts = max_connection_attempts,
235235
max_connection_timeout = max_connection_timeout,
236236
auth = auth,
237+
username = username,
238+
password = password,
237239
connect_opts = {
238240
ssl = ssl,
239241
ssl_verify = ssl_verify,
@@ -263,6 +265,8 @@ function storage.new(configuration)
263265
max_connection_attempts = max_connection_attempts,
264266
max_connection_timeout = max_connection_timeout,
265267
auth = auth,
268+
username = username,
269+
password = password,
266270
},
267271
}, metatable)
268272
end

0 commit comments

Comments
 (0)