-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathKnownUserImplementationHelpers.lua
More file actions
72 lines (71 loc) · 2.05 KB
/
KnownUserImplementationHelpers.lua
File metadata and controls
72 lines (71 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
--[[
The KnownUser lib is implemented using only Lua base functionality; compatible with v.5.1.
All those non-standard Lua function calls, needed by KnownUser, are exposed as helper methods below.
So, to make KnownUser functionality work correctly, these methods would need to implemented
using whatever libs are available on the executing environment.
]]--
local iHelpers =
{
request =
{
-- arguments: name -> name of header
-- returns: string | nil
getHeader = function(_)
error("Not implemented : request.getHeader(name)")
end,
-- returns: string | nil
getBody = function(_)
error("Not implemented : request.getBody()")
end,
-- arguments: name -> name of cookie
-- returns: the unescaped (url decoded) value ( string | nil ) in the cookie found by name
getUnescapedCookieValue = function(_)
error("Not implemented : request.getUnescapedCookieValue(name)")
end,
-- returns the url (string) user requested
getAbsoluteUri = function()
error("Not implemented : request.getAbsoluteUri()")
end,
-- returns the IP (string) of the user (host)
getUserHostAddress = function()
error("Not implemented : request.getUserHostAddress()")
end
},
response =
{
cookieOptions =
{
-- set to any string value (none, strict, lax) if response cookies should have samesite flag set
-- only use 'strict' if your queue protected site stays on same domain (no navigation to subdomains)
sameSite = nil
},
-- arguments: name, value, expire, domain, isHttpOnly, isSecure
-- returns: void
setCookie = function(_, _, _, _, _, _)
error("Not implemented : response.setCookie(name, value, expire, domain, isHttpOnly, isSecure)")
end
},
hash =
{
-- arguments: value, key
-- returns: string
hmac_sha256_encode = function(_, _)
error("Not implemented : hash.hmac_sha256_encode(value, key")
end
},
json =
{
-- arguments: jsonStr
-- returns: string
parse = function(_)
error("Not implemented : json.encode(jsonStr)")
end
},
system =
{
getConnectorName = function()
return "unspecified"
end
}
}
return iHelpers