cdbattags / lua-resty-jwt

JWT For The Great Openresty
Apache License 2.0
146 stars 44 forks source link

typo on default validation options #14

Closed guanglinlv closed 4 years ago

guanglinlv commented 5 years ago

Hi

is it a typo ? exp and nbf never defined. see L359

cdbattags commented 5 years ago

Should be working as intended. Those keys should always exist in your JWT, no?

I didn't write this specific line of code but yes, I believe you're right.

Should be: string_constant.thing

guanglinlv commented 5 years ago

I did the following change, it works as expect IMO.

function _M.get_default_validation_options(self, jwt_obj)
  return {
    [str_const.require_exp_claim]=jwt_obj[str_const.payload][str_const.exp] ~= nil,
    [str_const.require_nbf_claim]=jwt_obj[str_const.payload][str_const.nbf] ~= nil
  }
end
eliauren commented 5 years ago

Is there any PR planned to fix this ? Thanks in advance.

cdbattags commented 5 years ago

@guanglinlv, want to put in a PR for this?