#[non_exhaustive]pub enum Credentials {
Bearer {
token: String,
},
ApiKey {
key: String,
},
Basic {
username: String,
password: String,
},
CustomHeader {
header_name: String,
value: String,
},
ClientCertificate {
der: Vec<u8>,
},
None,
}Expand description
Raw credentials extracted from a request before validation.
This enum is transport-agnostic — it represents the normalized form of whatever the client sent, regardless of whether the transport is HTTP/SSE, stdio, or something else entirely.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Bearer
Authorization: Bearer <token> header.
ApiKey
X-Api-Key: <key> header, or ?api_key=<key> query parameter.
Basic
Authorization: Basic <base64(username:password)> header.
CustomHeader
A custom single-header credential. The header name is normalized to lowercase.
ClientCertificate
Verified TLS peer certificate (mTLS). Contains the DER-encoded bytes of the leaf certificate.
None
No credentials were present in the request. Used to distinguish “unauthenticated request” from “invalid credentials”.
Implementations§
Trait Implementations§
Source§impl Clone for Credentials
impl Clone for Credentials
Source§fn clone(&self) -> Credentials
fn clone(&self) -> Credentials
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for Credentials
impl RefUnwindSafe for Credentials
impl Send for Credentials
impl Sync for Credentials
impl Unpin for Credentials
impl UnsafeUnpin for Credentials
impl UnwindSafe for Credentials
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
Mutably borrows from an owned value. Read more