Skip to content

Commit e131b08

Browse files
authored
Merge pull request #209 from zmartzone/create_new_session_on_refresh
create a new session id when the token has been refreshed
2 parents 5023588 + 0ae91d6 commit e131b08

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
10/16/2018
2+
- lua-resty-openidc now creates a new session whenever the token(s)
3+
are refreshed, trying to soften the impact when multiple requests
4+
race to refresh the token at the same time. See #190 and #209
5+
16
10/11/2018
27
- url-encode client_id/client_secret; closes #204 and #205; thanks @grrolland
38
https://tools.ietf.org/html/rfc6749#section-2.3.1

lib/resty/openidc.lua

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,8 +1202,13 @@ local function openidc_access_token(opts, session, try_to_renew)
12021202
end
12031203
end
12041204

1205-
-- save the session with the new access_token and optionally the new refresh_token and id_token
1206-
session:save()
1205+
-- save the session with the new access_token and optionally the new refresh_token and id_token using a new sessionid
1206+
local regenerated
1207+
regerenerated, err = session:regenerate()
1208+
if err then
1209+
log(ERROR, "failed to regenerate session: " .. err)
1210+
return nil, err
1211+
end
12071212

12081213
return session.data.access_token, err
12091214
end

0 commit comments

Comments
 (0)