aboutsummaryrefslogtreecommitdiffstats
path: root/server/resty/session/identifiers
diff options
context:
space:
mode:
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>2023-04-14 11:59:32 +0000
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>2023-04-14 11:59:32 +0000
commitd68841d9f75636575cd778838a8ceea5fd5aada3 (patch)
tree778c84203ed9bfa4dc1c8234e4e2cf60da6ebd8c /server/resty/session/identifiers
parent42af09588f1f839b9ab36356f02f34c89559bcfa (diff)
Upload ui
Issue-ID: PORTAL-1084 Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de> Change-Id: Id0c94859a775094e67b0bb9c91ca5e776a08c068
Diffstat (limited to 'server/resty/session/identifiers')
-rw-r--r--server/resty/session/identifiers/random.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/server/resty/session/identifiers/random.lua b/server/resty/session/identifiers/random.lua
new file mode 100644
index 0000000..a2f9739
--- /dev/null
+++ b/server/resty/session/identifiers/random.lua
@@ -0,0 +1,13 @@
+local tonumber = tonumber
+local random = require "resty.random".bytes
+local var = ngx.var
+
+local defaults = {
+ length = tonumber(var.session_random_length, 10) or 16
+}
+
+return function(session)
+ local config = session.random or defaults
+ local length = tonumber(config.length, 10) or defaults.length
+ return random(length, true) or random(length)
+end