fix(32.2): WR-01 apply DefaultScopes to offline_access-only authorize requests

A request naming only offline_access now gets Options.DefaultScopes (when set) plus offline access instead of a pending request with zero data scopes. The read fallback is only used when the server accepts read; otherwise the request is refused with invalid_scope (RFC 6749 3.3).
This commit is contained in:
Jakub Zych
2026-11-21 09:05:07 +01:00
parent 20260e8bb4
commit fa7a84821e
5 changed files with 74 additions and 14 deletions

View File

@@ -106,7 +106,7 @@ The metadata document advertises these paths under the issuer, so mount them at
## Consent
The authorization endpoint sends the browser to `<issuer>/connect?request=<id>`, or to `wristband.Options.ConsentPath` on the issuer when the application sets one (for a consent page under the admin prefix, for example); an empty path keeps the PHP bytes exactly. A request that names no data scope gets `read`, or `wristband.Options.DefaultScopes` filtered to the accepted scopes when that list leaves anything. That page belongs to the application: it signs the user in, shows what the client asks for and posts the decision to the application's own consent handler, which calls:
The authorization endpoint sends the browser to `<issuer>/connect?request=<id>`, or to `wristband.Options.ConsentPath` on the issuer when the application sets one (for a consent page under the admin prefix, for example); an empty path keeps the PHP bytes exactly. A request that names no data scope gets `read`, or `wristband.Options.DefaultScopes` filtered to the accepted scopes when that list leaves anything; a server that accepts neither refuses it with `invalid_scope`. With `wristband.Options.DefaultScopes` set, a request that names only `offline_access` gets those scopes too and keeps offline access. That page belongs to the application: it signs the user in, shows what the client asks for and posts the decision to the application's own consent handler, which calls:
- `wristband.Server.PendingRequest` to read what to show, as a `wristband.PendingRequestView`, including `wristband.PendingRequestView.OfflineAccess` (the pending row's flag; `offline_access` is not a scope on the view and `wristband.Server.IssueCode` is unchanged);
- `wristband.Server.IssueCode` to grant, which returns the redirect URL carrying the code, `iss` and `state`;