File tree Expand file tree Collapse file tree 1 file changed +29
-4
lines changed
Expand file tree Collapse file tree 1 file changed +29
-4
lines changed Original file line number Diff line number Diff line change 1+ local libjwt_c = loadfile (" ./jwks_c.lua" )
12local _M = {}
23
34function _M .get_params (params )
45 local result = {
56 header_token = " Authorization" ,
7+ jwks_files = {},
68 }
79 if params == nil then
810 return nil , " params is required"
@@ -39,15 +41,38 @@ function _M.split(str, sep)
3941 return result , " "
4042end
4143
44+
45+ local open = io.open
46+ function _M .read_file (path )
47+ local file = open (path , " rb" )
48+ if not file then return nil end
49+ local content = file :read " *a"
50+ file :close ()
51+ return content
52+ end
53+
54+
55+ function _M .get_token (headers , field_token )
56+ local auth_header = headers [field_token ]
57+ local jwtToken , err = _M .split (auth_header , " " )
58+ if err == " param is required" then
59+ return nil , " token not found"
60+ end
61+ if err ~= " " then
62+ return nil , err
63+ end
64+ if jwtToken [2 ] == nil then
65+ return nil , " token not found"
66+ end
67+ return jwtToken [2 ], " "
68+ end
69+
70+
4271function _M .validate (params )
4372 local params , err = _M .get_params (params )
4473 if err ~= " " then
4574 return nil , err
4675 end
47- return false , " Not implemented"
4876end
4977
50-
51-
52-
5378return _M
You can’t perform that action at this time.
0 commit comments