Repository navigation
v0.38.0
·
18 commits
to main
since this release
Immutable
release. Only release title and notes can be modified.
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 callawait 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
asynccall for a route of the protected resource. It exchanges the token of this very request at the issuer and answersExchangedAccess(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
RuntimeErrorwhereresource_personraises, andValueErrorforscopesthat are not a non-empty tuple of scope tokens; nothing is posted then. expires_atis whole wall-clock seconds: the clock before the request plus the issuer'sexpires_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 wholeexpires_inof at least 1 isTOKEN_ENDPOINT_FAILED(stricter than RFC 8693, which recommendsexpires_in). - Host duties:
scopescome 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).idof the same request; - at most one exchange in flight per caller, and a refusal is not retried on every request.
- An
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 itsurlalone or exactly itsurland 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.
- With
docs/VISION.mdnames 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