File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed
Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -22,18 +22,19 @@ function _M.validate( params)
2222 return false , err
2323 end
2424 for i , jwks_file in ipairs (params .jwks_files ) do
25- local jwks = _M .read_file (jwks_file )
26- if jwks == nil then
27- return false , " jwks file not found "
25+ local file = _M .read_file (jwks_file )
26+ if file == nil then
27+ goto continue
2828 end
29- local jwks_set = jwks_c .jwks_create (jwks );
29+ local jwks_set = jwks_c .jwks_create (file );
3030 local jwks_item = jwks_c .jwks_item_get (jwks_set , 0 );
3131 local checker = jwks_c .jwt_checker_new ();
3232 jwks_c .jwt_checker_setkey (checker , jwks_c .JWT_ALG_RS256 , jwks_item );
3333 local result = jwks_c .jwt_checker_verify (checker , token );
3434 if result == 0 then
3535 return true , " "
3636 end
37+ :: continue::
3738 end
3839 return false , " token not valid"
3940end
Original file line number Diff line number Diff line change 1414 local libjwt = require( "resty.libjwt" )
1515 local valid, err = libjwt.validate( {
1616 ["header_token" ] = "Authorization" ,
17- ["jwks_files" ] = { "/usr/share/tokens/jwks.json" } ,
17+ ["jwks_files" ] = { "/usr/share/tokens/jwks.json" } ,
1818 } )
1919 if err ~ = "" then
2020 return ngx.say( err)
You can’t perform that action at this time.
0 commit comments