Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion srv/.lua/jwt.lua
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,17 @@ function JWS.VerifyTable(jwtTable, key, algorithms)
assert(type(jwtTable.header) == "table", "Parameter: 'jwtTable' does not contain a header table")
assert(jwtTable.payload ~= nil, "Parameter: 'jwtTable' does not contain a payload")

-- Claims (optional)
if(jwtTable.payload.nbf ~= nil) then
assert(type(jwtTable.payload.nbf) == "number", "Claim: 'nfb' must be a number")
assert(jwtTable.payload.nbf <= GetDate(), "Claim: 'nfb' is not valid")
end

if(jwtTable.payload.exp ~= nil) then
assert(type(jwtTable.payload.exp) == "number", "Claim: 'exp' must be a number")
assert(jwtTable.payload.exp >= GetDate(), "Claim: 'exp' must not be expired")
end

-- if no algorithms are specified, fall back onto the supported algorithms
algorithms = algorithms or JWA.supported
if type(algorithms) == "string" then algorithms = { algorithms } end
Expand Down Expand Up @@ -435,4 +446,4 @@ JWT._Common = Common
JWT._JWS = JWS
JWT._JWA = JWA

return JWT
return JWT