Skip to content

Commit

Permalink
add additional arguments to on_authenticated lifecycle hook
Browse files Browse the repository at this point in the history
helps with #413

Signed-off-by: Stefan Bodewig <[email protected]>
  • Loading branch information
bodewig committed Dec 17, 2021
1 parent c35b40a commit 8462979
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
12/17/2021
- added id_token and the token endpoint response as additional
arguments to the on_authenticated lifecycle hook; see #413

11/19/2021
- added opts.discovery_expires_in in order to make cache expiry of
OpenID Connect Discovery responses configurable.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ h2JHukolz9xf6qN61QMLSd83+kwoBr2drp6xg3eGDLIkQCQLrkY=
-- `openidc_authorize` immediately prior to saving the session
-- -- `on_authenticated` hook is invoked *after* receiving authorization response in
-- `openidc_authorization_response` immediately prior to saving the session
-- Starting with lua-resty-openidc 1.7.5 this receives the decoded id_token as second and the response of the token endpoint as third argument
-- -- `on_regenerated` is invoked immediately after the
a new access token has been obtained via token
refresh and is called with the regenerated session table
Expand Down
2 changes: 1 addition & 1 deletion lib/resty/openidc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,7 @@ local function openidc_authorization_response(opts, session)
end

if opts.lifecycle and opts.lifecycle.on_authenticated then
err = opts.lifecycle.on_authenticated(session)
err = opts.lifecycle.on_authenticated(session, id_token, json)
if err then
log(WARN, "failed in `on_authenticated` handler: " .. err)
return nil, err, session.data.original_url, session
Expand Down

0 comments on commit 8462979

Please sign in to comment.