forked from driverpt/kong-redis-session
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhandler.lua
25 lines (20 loc) · 968 Bytes
/
handler.lua
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
-- Extending the Base Plugin handler is optional, as there is no real
-- concept of interface in Lua, but the Base Plugin handler's methods
-- can be called from your child implementation and will print logs
-- in your `error.log` file (where all logs are printed).
local BasePlugin = require "kong.plugins.base_plugin"
local RedisSession = BasePlugin:extend()
local header_filter = require "kong.plugins.redis-session.header_filter"
-- Your plugin handler's constructor. If you are extending the
-- Base Plugin handler, it's only role is to instanciate itself
-- with a name. The name is your plugin name as it will be printed in the logs.
function RedisSession:new()
RedisSession.super.new(self, "redis-session")
end
function RedisSession:access(config)
-- Eventually, execute the parent implementation
-- (will log that your plugin is entering this context)
RedisSession.super.access(self)
header_filter.execute(config, ngx)
end
return RedisSession