pub struct CardRefScope(/* private fields */);Expand description
A principal’s card authorization set.
Authorization is identity-based on (kind, name, version). The
optional resolved uid is ignored.
Implementations§
Source§impl CardRefScope
impl CardRefScope
Sourcepub fn from_root_and_members(
root: &CardRef,
members: impl IntoIterator<Item = CardRef>,
) -> CardRefScope
pub fn from_root_and_members( root: &CardRef, members: impl IntoIterator<Item = CardRef>, ) -> CardRefScope
Build a scope and guarantee that root is the first member.
Duplicate identity (same (kind, name, version), ignoring uid)
is removed. Root is always retained as the first element.
A duplicate that carries a resolved uid donates it to the retained
entry. Mint resolves each scope member against the tenant-local
registry while its callers still hold the authored, UID-less root, so
without this the resolved root identity would be dropped and ingest
could not stamp subject_card_uid from signed claims alone.
Sourcepub fn own(root: &CardRef) -> CardRefScope
pub fn own(root: &CardRef) -> CardRefScope
Build an own-card-only scope.
Passing this as card_ref_scope on issuance is the canonical way to
express “this token is scoped only to its own card.” An empty
card_ref_scope on a received wire token carries the same meaning and
is upgraded to own by the verifier’s seed_scope call.
Sourcepub fn permits_root(&self, root: &CardRef) -> bool
pub fn permits_root(&self, root: &CardRef) -> bool
True when the scope is empty (vacuously) or contains the root card.
An empty scope is permitted because the wire format omits the scope
field for own-scoped tokens and the verifier upgrades it to own(root)
via seed_scope. If you need a stricter guarantee that the root was
explicitly present at construction time, use authorizes on a
non-empty scope.
Return true when card is authorized by identity.
Trait Implementations§
Source§impl Clone for CardRefScope
impl Clone for CardRefScope
Source§fn clone(&self) -> CardRefScope
fn clone(&self) -> CardRefScope
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CardRefScope
impl Debug for CardRefScope
Source§impl Default for CardRefScope
impl Default for CardRefScope
Source§fn default() -> CardRefScope
fn default() -> CardRefScope
Source§impl<'de> Deserialize<'de> for CardRefScope
impl<'de> Deserialize<'de> for CardRefScope
Source§fn deserialize<D>(
deserializer: D,
) -> Result<CardRefScope, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<CardRefScope, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
impl Eq for CardRefScope
Source§impl PartialEq for CardRefScope
impl PartialEq for CardRefScope
Source§impl Serialize for CardRefScope
Serializes as a JSON array of Display strings ("Kind/name@version").
impl Serialize for CardRefScope
Serializes as a JSON array of Display strings ("Kind/name@version").
This is the canonical wire encoding for card_ref_scope members in JWT claims
and HTTP payloads. Individual card_ref fields use an object shape instead —
this asymmetry exists because scope members are positional (root-first) and
compact by design. An empty array means “own-card scope”; the verifier upgrades
it to own(root) via seed_scope.
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
impl StructuralPartialEq for CardRefScope
Auto Trait Implementations§
impl Freeze for CardRefScope
impl RefUnwindSafe for CardRefScope
impl Send for CardRefScope
impl Sync for CardRefScope
impl Unpin for CardRefScope
impl UnsafeUnpin for CardRefScope
impl UnwindSafe for CardRefScope
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.