Skip to content

Commit

Permalink
add configurable iat slack interval; increase default to 120; closes #1
Browse files Browse the repository at this point in the history
  • Loading branch information
Hans Zandbelt committed Oct 7, 2015
1 parent 44f4b70 commit 612ce57
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ http {
discovery = "https://accounts.google.com/.well-known/openid-configuration",
client_id = "<client_id",
client_secret = "<client_secret"
--authorization_params = { hd="pingidentity.com" }
--authorization_params = { hd="pingidentity.com" },
--scope = "openid email profile",
--iat_slack = 600,
}
-- call authenticate for OpenID Connect user authentication
Expand Down
3 changes: 2 additions & 1 deletion lib/resty/openidc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ local function openidc_validate_id_token(opts, id_token)
end

-- check issued-at timestamp
if id_token.iat < (os.time() - 10) then
local slack=opts.iat_slack and opts.iat_slack or 120
if id_token.iat < (os.time() - slack) then
ngx.log(ngx.ERR, "token is not valid yet: id_token.iat=", id_token.iat, ", os.time()=", os.time())
return false
end
Expand Down

0 comments on commit 612ce57

Please sign in to comment.