From 8ea945bde052a2f609d6f71091e1b8db1a542f7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20K=C3=A4semodel?= Date: Fri, 8 Dec 2023 10:13:05 -0300 Subject: [PATCH] feat: set the cookie lifetime to 1 day MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Daniel Käsemodel --- lib/resty/openidc.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/resty/openidc.lua b/lib/resty/openidc.lua index cbd855f..b59dd2f 100644 --- a/lib/resty/openidc.lua +++ b/lib/resty/openidc.lua @@ -1191,9 +1191,13 @@ function openidc.save_as_authenticated(opts,session,json,do_redirect) session.data.access_token = json.access_token session.data.access_token_expiration = current_time + openidc_access_token_expires_in(opts, json.expires_in) + session.cookie.lifetime = 24 * 60 * 60 -- 1 day (24 hours) if json.refresh_token ~= nil then session.data.refresh_token = json.refresh_token end + log(DEBUG, "save_as_authenticated : store_in_session 'access_token' :" + , " session.data.access_token_expiration=", session.data.access_token_expiration + , " session.cookie.lifetime=", session.cookie.lifetime) end if opts.lifecycle and opts.lifecycle.on_authenticated then