Added revocable session strategy to support OP initiated logout scenarios #330
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Session strategy to support revocation of sessions for front-channel and back-channel logout scenarios.
This strategy adds the ability to revoke logged in sessions. It will wrap another existing strategy just adding the revocation functionality. To use it, specify
revocable
as the session strategy. It will wrap thedefault
strategy by default. To wrap another strategy, setngx.var.revocable_session_strategy
to the strategy you want to use, e.g.regenerate
.The
revocable
strategy will check sessions against a revocation list. By default the revocation list will be stored using the same storage adapter used by the session. This does not work for thecookie
storage adapter (for obvious reasons). The storage adapter to be used can be overridden (e.g. ifcookie
is otherwise desired for session storage) by settingngx.var.revocable_storage
, e.g. toredis
. Any additional configuration of the storage adapter can be passed through thesession_opts
argument when calling the openidc methods which accept asession_opts
argument.To actually revoke a session, call
revocable.revoke()
e.g. from acontent_by_lua_block
directive:This is just to prove the concept. It would probably be preferred to add the call to the logout processing already called from
openidc.authenticate()
when thelogout_uri
is processed, or if it's more appropriate to add specific openidc options to specify front-channel and back-channel logout URIs explicitly.