pub struct RequiredCredential {
pub kind: Option<CredentialKind>,
pub scopes: Vec<Scope>,
pub site_hint: Option<AttachmentSite>,
}Expand description
What a method requires on input — the implicit-derivation projection of scope tagging and credential-graph linkage onto a per-method filter.
Pinned by AUTHZ-CRED-S01-output.md §4 (Q-SELECT-1 resolution: implicit
derivation from scope tagging plus refresh/revoke linkage) and
AUTHZ-CRED-CORE-3 §“Implicit derivation”. This ticket explicitly does
NOT add a #[plexus::method(requires_credential = { .. })] attribute
surface — the proposal from AUTHZ-CRED-S01-output §10 is superseded by
the implicit-derivation approach pinned here.
§Matching semantics (consumer-side)
A candidate credential matches this RequiredCredential iff:
kind: ifSome(k), the candidate’sCredentialMetadata.kindmatchesk(or the kind-subsumption table perAUTHZ-CRED-CORE-1accepts the substitution; e.g.OauthAccess <: Bearer). IfNone, any kind whose scope set matches is acceptable.scopes: each scope in this set must be wildcard-matched by the candidate’sCredentialMetadata.scopes. The wildcard rules belong to theScopetype itself.site_hint: when populated, prefers the candidate whoseCredentialMetadata.attach_asequals the hint. Advisory only — a candidate without the hint is not rejected.
§Wire back-compat
Added in AUTHZ-CRED-CORE-3. Pre-existing readers tolerate
requires_credential: null (omitted on the wire when None) and
pre-existing IRs that omit the field altogether decode cleanly via
#[serde(default)] on the field site.
Fields§
§kind: Option<CredentialKind>Specific kind a candidate credential must have (e.g.,
OauthRefresh), or None for “any kind whose scope set matches”.
scopes: Vec<Scope>Required scope set. A candidate credential’s metadata scopes must wildcard-match each scope in this set.
site_hint: Option<AttachmentSite>Preferred attach site for the client to use when the candidate credential has multiple alternates. Advisory only.
Implementations§
Source§impl RequiredCredential
impl RequiredCredential
Sourcepub fn from_method_scope(scope: Scope) -> Self
pub fn from_method_scope(scope: Scope) -> Self
Derive a RequiredCredential from a method’s required scope tagging
(per AUTHZ-S01-output §4). The kind field is left None — any
kind whose scope set wildcard-matches scope is acceptable.
Used when a method declares #[plexus::method(scope = "...")] (or
the framework derives an implicit scope from the method’s path).
Sourcepub fn from_refresh_revoke_target(
kind: CredentialKind,
scopes: Vec<Scope>,
) -> Self
pub fn from_refresh_revoke_target( kind: CredentialKind, scopes: Vec<Scope>, ) -> Self
Derive a RequiredCredential for a method that appears as the target
of another credential’s metadata.refresh_via or metadata.revoke_via
(per AUTHZ-CRED-CORE-3 §“Implicit derivation” row 3). The kind
field narrows to the issuing credential’s kind so the selection step
picks the right kind (e.g., OauthRefresh for the
auth.refresh call on an OauthAccess credential per the OAuth
flow described in AUTHZ-CRED-S01-output §7.2).
Trait Implementations§
Source§impl Clone for RequiredCredential
impl Clone for RequiredCredential
Source§fn clone(&self) -> RequiredCredential
fn clone(&self) -> RequiredCredential
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 RequiredCredential
impl Debug for RequiredCredential
Source§impl<'de> Deserialize<'de> for RequiredCredential
impl<'de> Deserialize<'de> for RequiredCredential
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for RequiredCredential
impl JsonSchema for RequiredCredential
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for RequiredCredential
impl PartialEq for RequiredCredential
Source§fn eq(&self, other: &RequiredCredential) -> bool
fn eq(&self, other: &RequiredCredential) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for RequiredCredential
impl Serialize for RequiredCredential
impl Eq for RequiredCredential
impl StructuralPartialEq for RequiredCredential
Auto Trait Implementations§
impl Freeze for RequiredCredential
impl RefUnwindSafe for RequiredCredential
impl Send for RequiredCredential
impl Sync for RequiredCredential
impl Unpin for RequiredCredential
impl UnsafeUnpin for RequiredCredential
impl UnwindSafe for RequiredCredential
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.