Skip to content

Adding functions to invalidate the various caches #142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 13, 2018
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
02/08/2018
- added functions to manually request the invalidation of the caches; see #142

02/06/2018
- added more logging that may help debugging configuration; see #140; thanks @pamiel

Expand Down
17 changes: 17 additions & 0 deletions lib/resty/openidc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,23 @@ local function openidc_cache_get(type, key)
return value
end

-- invalidate values of server-wide cache
local function openidc_cache_invalidate(type)
local dict = ngx.shared[type]
if dict then
ngx.log(ngx.DEBUG, "flushing cache for "..type)
dict.flush_all(dict)
local nbr = dict.flush_expired(dict)
end
end

-- invalidate all server-wide caches
function openidc.invalidate_caches()
openidc_cache_invalidate("discovery")
openidc_cache_invalidate("jwks")
openidc_cache_invalidate("introspection")
end

-- validate the contents of and id_token
local function openidc_validate_id_token(opts, id_token, nonce)

Expand Down