janiussyafiq opened a new pull request, #13792:
URL: https://github.com/apache/apisix/pull/13792

   ### Description
   
   In the authorization code flow the tokens live in the session cookie, and 
nothing revisits the identity provider until the stored token expiry passes: a 
token revoked at the provider (logout via another application, administrative 
session termination) keeps being accepted and forwarded upstream until it 
expires.
   
   This adds an opt-in `introspect_session_access_token` option that 
introspects (RFC 7662) the access token held in the session on every request:
   
   - An inactive verdict destroys the session and the request follows 
`unauth_action`. The negative verdict is cached for 10 seconds so replays of a 
discarded session cookie do not flood the introspection endpoint. The TTL is 
deliberately a fixed constant rather than a schema field: it has no user-facing 
semantic to tune, and reusing `introspection_interval` would both disable the 
protection at its default `0` and conflate it with how long a positive verdict 
may be trusted. It can be promoted to a schema field later if a need appears.
   - No verdict (introspection endpoint unreachable or missing) returns `503` 
and keeps the session — deliberately fail-closed, also under 
`unauth_action=pass`, so a possibly revoked token never reaches the upstream 
while a provider hiccup does not log the whole user base out.
   - Active verdicts are cached only when `introspection_interval > 0`; the 
default introspects every request, since a cached "active" delays revocation 
detection by its TTL.
   
   Not allowed together with `bearer_only` (rejected by the schema): 
header-presented tokens are already introspected; only the session path lacked 
revocation checking. lua-resty-openidc deliberately leaves this to the caller 
(see zmartzone/lua-resty-openidc#412) and exposes the pieces used here 
(`call_token_endpoint`, `get_discovery_doc`). OIDC Back-Channel Logout would be 
the complementary mechanism, but it requires server-side session storage 
indexed by `sid`, so it is out of scope here.
   
   #### Which issue(s) this PR fixes:
   
   Fixes #13750
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [x] I have explained the changes or the new features added to this PR
   - [x] I have added tests corresponding to this change
   - [x] I have updated the documentation to reflect this change
   - [x] I have verified that this change is backward compatible (If not, 
please discuss on the [APISIX mailing 
list](https://github.com/apache/apisix/tree/master#community) first)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to