Skip to content

RFC 7009 token revocation endpoint #6966

Open

Description

@jhrozek

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_client for 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-store and Pragma: no-cache.
  • Discovery adds revocation_endpoint, and revocation_endpoint_auth_methods_supported equal to the token endpoint's list.

  • exchange_grant.revoked audit 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions