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

@@ -100,10 +100,13 @@ type Options struct {
ConsentPath string
// DefaultScopes is what an MCP authorize request gets when it names no
// data scope (an absent, empty or identity-only scope value). Only the
// names the server accepts (ScopesSupported, resolved) are kept; empty
// or unset, or empty after that filter, means the PHP default ["read"].
// The OIDC flavour ignores it.
// data scope (an absent, empty or identity-only scope value, or, while
// this list is set, one that names only offline_access, which keeps
// offline access). Only the names the server accepts (ScopesSupported,
// resolved) are kept, offline_access never; empty or unset, or empty
// after that filter, means the PHP default ["read"], and a server that
// does not accept read refuses the request with invalid_scope. The OIDC
// flavour ignores it.
DefaultScopes []string
}