pub trait ConsentScopes:
Send
+ Sync
+ 'static {
const SCOPES: &'static [&'static str];
// Provided method
fn scope_line() -> String { ... }
}Expand description
The OAuth2 scope atoms a marker type requests at consent.
Implemented by each face SDK for its own sealed scope-set markers. A crate
running the authorization leg takes S: ConsentScopes and puts
scope_line on the wire without knowing which
SDK S came from.
§Atoms, not a joined string
SCOPES is a slice because two things need set
semantics, and neither can be had from a pre-joined string:
- The granted-vs-requested covers-check. RFC 6749 §5.1 lets the token
response echo the granted scope; §3.3 makes order and whitespace
insignificant. So the check is
granted ⊇ requestedover atom sets — never string equality, which would reject a reordered echo. - Per-atom drift pinning. Workspace tests assert every atom of every family is present in the PAS scope catalog and in the PCS capability map. Set membership is the assertion; a joined string would have to be re-split by every test.
Do not add a parallel joined const. Two declarations of the same fact
is precisely the drift this contract exists to remove — the joined form is
derived on demand by scope_line.
§Membership is not this trait’s business
Which atoms a tier contains is the owning SDK’s decision and changes on the
owning SDK’s release cadence alone. This trait’s shape is
membership-invariant: a tier gaining an atom releases one SDK minor and
requires nothing from this crate. (Server-first, always — the atom must be
live in the PAS catalog and the client’s allowlist before a binary requests
it, or authorize fails loud. The owning SDK’s scopes module carries the
full runbook.)
Required Associated Constants§
Provided Methods§
Sourcefn scope_line() -> String
fn scope_line() -> String
The atoms encoded for the wire — space-separated, RFC 6749 §3.3.
Not a const: joining allocates, and neither const trait fns nor const
heap allocation are stable. It runs once per authorization request, so
the allocation is not on any hot path.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".