-
Notifications
You must be signed in to change notification settings - Fork 3k
feat(openid-connect): support stateless session revocation #13651
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
Open
Hockenba
wants to merge
8
commits into
apache:master
Choose a base branch
from
geico:feat/openid-connect-stateless-session-revocation
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0ee480e
feat(openid-connect): support stateless session revocation
Hockenba cf2cc5e
refactor(openid-connect): expose session revocation backend
Hockenba 7572d22
fix(openid-connect): avoid unconditional revocation default
Hockenba 0c3c35c
for lua-resty-openidc changes
Hockenba cac900b
update to newest openidc with my commit
Hockenba a56f816
Merge apache/master into feat/openid-connect-stateless-session-revoca…
Hockenba e9022c1
in memory cache config options
Hockenba 5c1b46d
Merge branch 'master' of https://github.com/apache/apisix into feat/o…
Hockenba File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -294,7 +294,33 @@ local schema = { | |
| description = "keepalive timeout in milliseconds", | ||
| }, | ||
| } | ||
| } | ||
| }, | ||
| revocation = { | ||
| type = "string", | ||
| enum = {"redis"}, | ||
| description = "Redis-backed revocation for cookie sessions.", | ||
| }, | ||
| revocation_fail_mode = { | ||
| type = "string", | ||
| enum = {"open", "closed"}, | ||
| description = | ||
| "When the revocation store is unreachable, open treats the " | ||
| .. "session as not revoked and closed rejects open/destroy.", | ||
| }, | ||
| revocation_cache_ttl = { | ||
| type = "integer", | ||
| minimum = 0, | ||
|
Hockenba marked this conversation as resolved.
|
||
| description = | ||
| "Worker-local TTL in seconds for successful revocation " | ||
| .. "lookups. 0 disables. Default is 5 in lua-resty-session.", | ||
| }, | ||
| revocation_error_cache_ttl = { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Waiting for bungle/lua-resty-session#213
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. Still feel free to take a peak at to make sure that I implemented what was requested :) |
||
| type = "integer", | ||
| minimum = 0, | ||
| description = | ||
| "Worker-local TTL in seconds for revocation store errors. " | ||
| .. "0 disables. Default is 5 in lua-resty-session.", | ||
| }, | ||
| }, | ||
| required = {"secret"}, | ||
| ["if"] = { | ||
|
|
@@ -305,6 +331,19 @@ local schema = { | |
| ["then"] = { | ||
| required = {"redis"}, | ||
| }, | ||
| allOf = { | ||
| { | ||
| ["if"] = { | ||
| required = {"revocation"}, | ||
| }, | ||
| ["then"] = { | ||
| required = {"redis"}, | ||
| properties = { | ||
| storage = { const = "cookie" }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| additionalProperties = false, | ||
| }, | ||
| realm = { | ||
|
|
@@ -1371,6 +1410,17 @@ function _M.rewrite(plugin_conf, ctx) | |
| return 401 | ||
| end | ||
|
|
||
| -- fail-closed only: resty.session appends the store error, so match | ||
| -- the prefix. Reject without destroying the cookie. | ||
| if core.string.find(err, "unable to check session revocation") | ||
| or core.string.find(err, "unable to mark session revoked") then | ||
| if session then | ||
| session:close() | ||
| end | ||
| core.log.error("OIDC session revocation store unavailable: ", err) | ||
| return 503 | ||
| end | ||
|
|
||
| -- Recoverable authorization-callback failures: a stale state | ||
| -- (replayed or pruned callback), or the ID provider redirecting | ||
| -- back with error=temporarily_unavailable, e.g. Keycloak after | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.