Repository navigation
Description
Part of #6886. Depends on #6897.
Problem: the authorization server has no revocation endpoint. Clients cannot revoke login refresh tokens, or refresh tokens issued by token exchange. Discovery advertises no revocation_endpoint.
Change:
-
POST /oauth/revoke, with the same body handling and limits as/oauth/token. It registers fosite's revocation factory, so login access and refresh tokens become revocable. -
A revocation handler for grants issued by token exchange:
- check the HMAC, look up the grant, check the client, mark it revoked;
- it is idempotent;
- a token that is not such a grant is left to fosite's handler.
Revoking a grant makes its children unusable through the parent check.
-
The route writes its own response, because fosite answers most errors with 200:
unauthorized_clientfor another client's token: 400 (RFC 7009 §2.1);- store failure: 503 (§2.2.1);
- unknown or forged token: 200;
- every response sets
Cache-Control: no-storeandPragma: no-cache.
-
Discovery adds
revocation_endpoint, andrevocation_endpoint_auth_methods_supportedequal to the token endpoint's list. -
exchange_grant.revokedaudit log line. -
User-facing authorization server docs get a revocation section.
Acceptance:
- Login refresh tokens:
- one revoked by its own client is refused at the refresh grant;
- one revoked by another client gets 400
unauthorized_client.
- Unknown and forged tokens get 200.
- Grants:
- revoking another client's grant gets 400 and leaves it usable;
- revoking its own grant gets 200, and deriving from it then fails with
revoked; - a second revoke gets 200;
- a child of a revoked parent fails with
parent_revoked; - revoking a child leaves the parent usable.
- A failing store gets 503.
- Discovery lists both fields.
- The kind e2e (Kind e2e for refresh tokens issued by token exchange #6965) is extended: revoking a parent grant stops derivation, and revoking a Dex-login refresh token stops refresh.
Activity
test(identityharness): retire the fake AS-1; identity tests use the r…