Skip to content

v0.38.0

Choose a tag to compare

@github-actions github-actions released this 12 Nov 17:14
· 18 commits to main since this release
Immutable release. Only release title and notes can be modified.
46bf8d3

What changes in 0.38.0

0.38.0 lets an app act for the caller of its protected resource at another service: it exchanges the token the resource admitted for one the other service accepts (OAuth 2.0 Token Exchange, RFC 8693). Nothing changes for an app that does not use it.

Per app

  • hopin (first user): declare the resource with admits_client_audience=True, and call await exchanged_access_token(request, scopes=...) inside the admitted resource request. The realm adds the app's client as second audience only after this version runs with the flag on.
  • skat, songmaker, presentator: nothing.

New

  • webauth.middleware.exchanged_access_token(connection, *, scopes) -> ExchangedAccess | OidcRefusal (#741, PR #742; docs/host-contract.md, EXCHANGE-01 to EXCHANGE-14).
    • An async call for a route of the protected resource. It exchanges the token of this very request at the issuer and answers ExchangedAccess(access_token: SecretStr, expires_at: int).
    • The host never sees the admitted token. It is read from the request again, posted only to the issuer of the gate that admitted it, as that gate's client, and never returned, stored or logged.
    • It raises RuntimeError where resource_person raises, and ValueError for scopes that are not a non-empty tuple of scope tokens; nothing is posted then.
    • expires_at is whole wall-clock seconds: the clock before the request plus the issuer's expires_in. It is never compared with the admitted token's expiry and can lie after it.
    • Refusals are closed codes. A 400, 401 or 403 with an error code is TOKEN_REQUEST_REFUSED; an answer that is not a bearer access token with a whole expires_in of at least 1 is TOKEN_ENDPOINT_FAILED (stricter than RFC 8693, which recommends expires_in).
    • Host duties:
      • scopes come from configuration, never from the request; what an app may obtain for a caller is the issuer's policy and the callee's group check;
      • a held token is keyed by resource_person(connection).id of the same request;
      • at most one exchange in flight per caller, and a refusal is not retried on every request.
  • ProtectedResource(..., admits_client_audience=False) (#739, PR #740; RESOURCE-18, RESOURCE-56, RESOURCE-84 to RESOURCE-87).
    • With True, the resource admits a token whose audiences are its url alone or exactly its url and the app's own client id, in either order, and nothing else.
    • Such a token stays refused on machine paths, on person paths and on a resource without the flag.
    • It exists because the issuer exchanges only a token that names the exchanging client; an app that does not exchange leaves it off.
  • docs/VISION.md names RFC 8693 among the standards webauth follows.

Breaking

None. No migration.

Not visible to a host

  • The token endpoint's types and answer readers live in a private module of webauth.oidc (#737, PR #738); every public import path stays.
  • The gate and release workflows pin quality v0.11.1 (#735, PR #744).

Full Changelog: v0.37.1...v0.38.0