pub enum AuthConfig {
None,
ApiKey {
query_params: HashMap<String, String>,
headers: HashMap<String, String>,
required: bool,
},
Bearer {
token: String,
required: bool,
},
Basic {
username: String,
password: String,
required: bool,
},
OAuth2ClientCredentials {
token_url: String,
client_id: String,
client_secret: String,
scopes: Vec<String>,
required: bool,
},
OAuthPassthrough {
target_header: String,
required: bool,
},
}Expand description
Outgoing-HTTP authentication configuration (OAPI-03 / D-05).
Lifted near-verbatim from the pmcp-run reference AuthConfig. The
#[serde(tag = "type", rename_all = "snake_case")] shape means a
config.toml [backend.auth] block selects the variant via type = "..."
(none, api_key, bearer, basic, oauth2_client_credentials,
oauth_passthrough). Default is AuthConfig::None.
Variants§
None
No authentication.
ApiKey
API key passed as query parameters and/or headers.
Fields
Bearer
Bearer token (Authorization: Bearer <token>).
Fields
Basic
HTTP Basic auth (Authorization: Basic <base64(user:pass)>).
Fields
username: StringUsername. Supports a ${VAR} / env:VAR reference (resolved at
provider-build time) for symmetry with password.
OAuth2ClientCredentials
OAuth2 client-credentials grant.
rename_all = "snake_case" derives the tag o_auth2_client_credentials,
but the documented config form (README, line-56 doc comment) is
type = "oauth2_client_credentials". The alias accepts the documented
spelling so [backend.auth] configs deserialize as documented.
Fields
OAuthPassthrough
Forward the INCOMING MCP client token to the backend (SSO passthrough, H1).
rename_all = "snake_case" derives the tag o_auth_passthrough, but the
documented config form (README, line-56 doc comment) is
type = "oauth_passthrough". The alias accepts the documented spelling so
[backend.auth] configs deserialize as documented.
Implementations§
Source§impl AuthConfig
impl AuthConfig
Sourcepub fn is_required(&self) -> bool
pub fn is_required(&self) -> bool
Whether this configuration requires authentication to succeed.
Trait Implementations§
Source§impl Clone for AuthConfig
impl Clone for AuthConfig
Source§fn clone(&self) -> AuthConfig
fn clone(&self) -> AuthConfig
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 AuthConfig
impl Debug for AuthConfig
Source§impl Default for AuthConfig
impl Default for AuthConfig
Source§fn default() -> AuthConfig
fn default() -> AuthConfig
Source§impl<'de> Deserialize<'de> for AuthConfig
impl<'de> Deserialize<'de> for AuthConfig
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 PartialEq for AuthConfig
impl PartialEq for AuthConfig
Source§fn eq(&self, other: &AuthConfig) -> bool
fn eq(&self, other: &AuthConfig) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for AuthConfig
impl Serialize for AuthConfig
impl Eq for AuthConfig
impl StructuralPartialEq for AuthConfig
Auto Trait Implementations§
impl Freeze for AuthConfig
impl RefUnwindSafe for AuthConfig
impl Send for AuthConfig
impl Sync for AuthConfig
impl Unpin for AuthConfig
impl UnsafeUnpin for AuthConfig
impl UnwindSafe for AuthConfig
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.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more