pub fn validate_requested_scopes(
requested: &[String],
server_supported: &[String],
client_declared: Option<&[String]>,
require_atproto: bool,
) -> Result<Vec<String>, ScopeError>Expand description
Validate a requested scope set against the server-supported and (optionally) client-declared scopes (#1113 rev2 finding 4).
Returns the actual granted set (the intersection of requested with the
server-supported set, intersected with client_declared when provided),
preserving the server’s canonical ordering of the supported scopes.
- Unknown / undeclared / malformed requested tokens yield
ScopeError::InvalidScope(RFC 6749 §4.1.2.1 / §3.3) so the caller rejects withinvalid_scope. - When
require_atprotois true (the atproto profile), the granted set MUST containATPROTO_SCOPE; otherwiseScopeError::AtprotoRequired.