Skip to content

Commit 7183e9d

Browse files
authored
Update documentation to describe the configuration of lua-resty-session version 4
The current documentation describes configuration for lua-resty-session version 3 only. Since following the default installation steps will set up lua-rest-session version 4, the documentation should reflect the configuration of version 4 instead. This configuration should also provide an answer to several outstanding questions in the GitHub issues.
1 parent 4702769 commit 7183e9d

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

README.md

+19-5
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,6 @@ http {
8383
# cache for JWKs
8484
lua_shared_dict jwks 1m;
8585
86-
# NB: if you have "lua_code_cache off;", use:
87-
# set $session_secret xxxxxxxxxxxxxxxxxxx;
88-
# see: https://github.com/bungle/lua-resty-session#notes-about-turning-lua-code-cache-off
89-
9086
server {
9187
listen 8080;
9288
@@ -242,8 +238,26 @@ h2JHukolz9xf6qN61QMLSd83+kwoBr2drp6xg3eGDLIkQCQLrkY=
242238
243239
}
244240
241+
-- Configure lua-resty-session
242+
-- The full list of configuration options is documented in the lua-resty-session GitHub repository: https://github.com/bungle/lua-resty-session?tab=readme-ov-file#session-configuration
243+
local session_opts = {
244+
-- When using cookies to store sessions, set a shared secret for session cookie encryption. This allows sessions to remain valid after a restart of nginx.
245+
-- It also enables "stateless" session management, so multiple instances of nginx can handle requests without the need for "sticky" load balancing techniques.
246+
-- secret = "xxxxxxxxxxxxxxxxxxx",
247+
-- Optionally, set the cookie prefix to prevent accidental overwriting of the session cookie
248+
-- cookie_prefix = "__Host-",
249+
-- Login session cookies should be HTTP Only
250+
cookie_http_only = true,
251+
-- Login session cookies should be marked as "Secure"
252+
cookie_secure = true,
253+
-- Set the same site cookie policy
254+
cookie_same_site = "Lax",
255+
-- Set this to true if you want login session cookies to persist a browser restart
256+
remember = true
257+
}
258+
245259
-- call authenticate for OpenID Connect user authentication
246-
local res, err = require("resty.openidc").authenticate(opts)
260+
local res, err = require("resty.openidc").authenticate(opts, nil, nil, session_opts)
247261
248262
if err then
249263
ngx.status = 500

0 commit comments

Comments
 (0)