nic-6443 commented on code in PR #13178:
URL: https://github.com/apache/apisix/pull/13178#discussion_r3381495843
##########
apisix/plugins/openid-connect.lua:
##########
@@ -33,6 +34,33 @@ local ngx_encode_base64 = ngx.encode_base64
local plugin_name = "openid-connect"
+-- Translate session config to lua-resty-session 4.x options.
+-- Most keys (cookie_name, cookie_path, *_timeout, etc.) are already named
+-- after lua-resty-session and pass straight through. The only translation
+-- is the legacy session.cookie.lifetime alias from the lua-resty-session 3.x
+-- schema, which is mapped to absolute_timeout when the latter is unset.
+local function build_session_opts(session_conf)
+ if not session_conf then
+ return nil
+ end
+ local opts = {}
+ for k, v in pairs(session_conf) do
+ if k ~= "cookie" then
+ opts[k] = v
+ end
+ end
+ local cookie = session_conf.cookie
+ if cookie and cookie.lifetime ~= nil then
+ if opts.absolute_timeout == nil then
+ opts.absolute_timeout = cookie.lifetime
+ core.log.warn("session.cookie.lifetime is deprecated; ",
+ "use session.absolute_timeout instead")
+ end
+ end
+ return opts
Review Comment:
```suggestion
if session_conf.cookie and session_conf.cookie.lifetime then
if not session_conf.absolute_timeout then
session_conf.absolute_timeout = session_conf.cookie.lifetime
core.log.warn("session.cookie.lifetime is deprecated; ",
"use session.absolute_timeout instead")
end
end
return session_conf
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]