Skip to content

Commit 8462979

Browse files
committed
add additional arguments to on_authenticated lifecycle hook
helps with #413 Signed-off-by: Stefan Bodewig <[email protected]>
1 parent c35b40a commit 8462979

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

ChangeLog

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
12/17/2021
2+
- added id_token and the token endpoint response as additional
3+
arguments to the on_authenticated lifecycle hook; see #413
4+
15
11/19/2021
26
- added opts.discovery_expires_in in order to make cache expiry of
37
OpenID Connect Discovery responses configurable.

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ h2JHukolz9xf6qN61QMLSd83+kwoBr2drp6xg3eGDLIkQCQLrkY=
212212
-- `openidc_authorize` immediately prior to saving the session
213213
-- -- `on_authenticated` hook is invoked *after* receiving authorization response in
214214
-- `openidc_authorization_response` immediately prior to saving the session
215+
-- 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
215216
-- -- `on_regenerated` is invoked immediately after the
216217
a new access token has been obtained via token
217218
refresh and is called with the regenerated session table

lib/resty/openidc.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,7 @@ local function openidc_authorization_response(opts, session)
11881188
end
11891189

11901190
if opts.lifecycle and opts.lifecycle.on_authenticated then
1191-
err = opts.lifecycle.on_authenticated(session)
1191+
err = opts.lifecycle.on_authenticated(session, id_token, json)
11921192
if err then
11931193
log(WARN, "failed in `on_authenticated` handler: " .. err)
11941194
return nil, err, session.data.original_url, session

0 commit comments

Comments
 (0)