summaryrefslogtreecommitdiffstats
path: root/scripts/ci/openresty/auth-api.lua
blob: 8ea336c0eabd358baeb031248fe49fa1c1c04748 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
-- Simple API for checking POST data

-- Get the request path
local reqPath = ngx.var.uri
-- Get the request method (POST, GET etc..)
local reqMethod = ngx.var.request_method
-- Get any URI arguments
local uriArgs = ngx.req.get_uri_args()
-- Get any POST arguments
ngx.req.read_body()
local postArgs = ngx.req.get_post_args()

-- We only reply to POST requests
if reqMethod ~= "POST"
then
    return false
end

ngx.say("Section: ", uriArgs.section, ", User: ", postArgs.user, ", Authenticated: true")