pub enum AuthMechanism {
Bearer {
header: HeaderName,
},
Cookie {
cookie: CookieName,
login: MethodPath,
refresh: Option<MethodPath>,
logout: Option<MethodPath>,
},
Oidc {
issuer: IssuerUrl,
client_id: ClientId,
exchange: Option<MethodPath>,
request_scopes: Vec<String>,
},
Anonymous,
}Expand description
Tagged union of supported auth mechanisms a backend advertises.
Wire form: discriminated on kind, snake_case ("bearer", "cookie",
"oidc", "anonymous"). See AUTHZ-S01-output §2 for canonical JSON
examples.
Variants§
Bearer
Static bearer token (today’s substrate --api-key shape). Not
user-bound; the token authorizes the bearer.
Fields
header: HeaderNameHeader carrying the token, e.g. Authorization.
Cookie
Cookie session, with a backend-defined login method that issues
Set-Cookie.
Fields
Name of the session cookie.
login: MethodPathMethod the client calls to issue/establish the cookie.
refresh: Option<MethodPath>Optional method to renew the cookie.
logout: Option<MethodPath>Optional method to invalidate the cookie.
Oidc
OIDC mechanism (designed-for; may not be implemented in initial epic).
Fields
exchange: Option<MethodPath>Optional auth.exchange-style method the backend exposes to swap
an ID token for a backend session cookie.
Anonymous
Anonymous — the backend accepts unauthenticated callers for some methods.
Advertising Anonymous is not permission to bypass scoping:
per-method #[plexus::method(public)] markers gate which methods
anonymous callers may invoke (AUTHZ-CORE-1 / AUTHZ-CORE-2). The
advertisement says “anonymous is one of the accepted shapes”; the
authorization layer says “this specific method is callable that way.”
Implementations§
Source§impl AuthMechanism
impl AuthMechanism
Sourcepub fn implied_attachment_site(&self) -> Option<AttachmentSite>
pub fn implied_attachment_site(&self) -> Option<AttachmentSite>
The [AttachmentSite] this mechanism implies for credential
placement on subsequent calls — the CA-1 derivation rule (trak facet
ccc924ad-0e78-4d4b-b71f-0018d249d0bf).
Mapping table:
| Mechanism | Implied site |
|---|---|
Bearer | Header { name: <advertised header> } |
Cookie | Cookie { name: <advertised cookie> } |
Oidc | Header { name: "authorization" } |
Anonymous | None (nothing to attach) |
Oidc maps to the bearer convention (Authorization: Bearer <jwt>)
because the OIDC validator accepts the ID/access token there; an
OIDC backend whose exchanged session rides a cookie should advertise
a Cookie mechanism alongside (and mark it default) to steer the
derivation.
Trait Implementations§
Source§impl Clone for AuthMechanism
impl Clone for AuthMechanism
Source§impl Debug for AuthMechanism
impl Debug for AuthMechanism
Source§impl<'de> Deserialize<'de> for AuthMechanism
impl<'de> Deserialize<'de> for AuthMechanism
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>,
impl Eq for AuthMechanism
Source§impl JsonSchema for AuthMechanism
impl JsonSchema for AuthMechanism
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 more