mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-05 10:41:34 +00:00
Add auth_session_duration parameter to the v1/create/ntopng/session.lua REST API
This commit is contained in:
parent
5a8fd8efd7
commit
e3ca57daf7
6 changed files with 71 additions and 25 deletions
|
|
@ -21,6 +21,7 @@ local rc = rest_utils.consts.success.ok
|
|||
local res = {}
|
||||
|
||||
local username = _POST["username"]
|
||||
local auth_session_duration = _POST["auth_session_duration"]
|
||||
|
||||
if username == nil then
|
||||
rest_utils.answer(rest_utils.consts.err.invalid_args)
|
||||
|
|
@ -29,7 +30,13 @@ end
|
|||
|
||||
username = string.lower(username)
|
||||
|
||||
res.session = ntop.createUserSession(username)
|
||||
local duration = 0
|
||||
|
||||
if not isEmptyString(auth_session_duration) then
|
||||
duration = tonumber(auth_session_duration)
|
||||
end
|
||||
|
||||
res.session = ntop.createUserSession(username, duration)
|
||||
|
||||
if isEmptyString(res.session) then
|
||||
rest_utils.answer(rest_utils.consts.err.invalid_args)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue