pub struct OAuth2ClientCredentials {
pub token_endpoint: String,
pub client_id: String,
pub client_secret: String,
pub scopes: Vec<String>,
pub mtls: Option<OAuth2Mtls>,
pub token_cache_ttl_s: Option<u64>,
}Expand description
OAuth2 client-credentials configuration for an upstream (DW-035,
upstreams[].oauth2_client_credentials).
The gateway obtains an access token from token_endpoint using the
client-credentials grant (RFC 6749 section 4.4) and forwards it to
the upstream as Authorization: Bearer <token>. The client
authenticates to the token endpoint with HTTP Basic auth
(client_id:client_secret, RFC 6749 section 2.3.1). Tokens are
cached per upstream (keyed by upstream name on the dataplane) and
refreshed lazily on the first request after expiry — no background
refresh task. An optional mtls block configures a client
certificate for the TLS handshake to the token endpoint itself
(RFC 8705, the tls_client_auth method).
Fields§
§token_endpoint: StringThe token endpoint URL (RFC 6749 section 3.2). Must be an
absolute http(s):// URL; validation rejects anything else.
client_id: StringThe client identifier presented to the token endpoint (RFC 6749 section 2.2). Sent as the username of the HTTP Basic auth header.
client_secret: StringThe client secret presented to the token endpoint (RFC 6749
section 2.3.1). Either the value INLINE (redacted in every
config echo, DW-045) or a ${...} secret reference (env or
file) resolved at config-compile time and re-read on every
reload. Sent as the password of the HTTP Basic auth header.
scopes: Vec<String>Optional scope string (RFC 6749 section 3.3): a space-delimited list of requested scopes sent in the token request body. Absent = no scope parameter (the endpoint’s default scopes apply).
mtls: Option<OAuth2Mtls>Optional mTLS client certificate for the TLS handshake to the
token endpoint itself (RFC 8705 tls_client_auth). Absent: the
token endpoint’s TLS is negotiated with no client certificate
(the default webpki root set, or a trusted_ca_file when the
token endpoint is behind a private CA — note the token endpoint
trust is NOT the upstream’s trusted_ca_file; the token
endpoint is a separate entity).
token_cache_ttl_s: Option<u64>Token cache TTL override in seconds. Absent (the default): use
the token’s own expires_in (minus a refresh skew margin). When
set, the cache TTL is min(token_expires_in - skew, token_cache_ttl_s) so a shorter override never extends a
token’s real lifetime. Must be > 0.
Trait Implementations§
Source§impl Clone for OAuth2ClientCredentials
impl Clone for OAuth2ClientCredentials
Source§fn clone(&self) -> OAuth2ClientCredentials
fn clone(&self) -> OAuth2ClientCredentials
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OAuth2ClientCredentials
impl Debug for OAuth2ClientCredentials
Source§impl<'de> Deserialize<'de> for OAuth2ClientCredentials
impl<'de> Deserialize<'de> for OAuth2ClientCredentials
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 OAuth2ClientCredentials
impl JsonSchema for OAuth2ClientCredentials
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 OAuth2ClientCredentials
impl PartialEq for OAuth2ClientCredentials
Source§impl Serialize for OAuth2ClientCredentials
impl Serialize for OAuth2ClientCredentials
impl StructuralPartialEq for OAuth2ClientCredentials
Auto Trait Implementations§
impl Freeze for OAuth2ClientCredentials
impl RefUnwindSafe for OAuth2ClientCredentials
impl Send for OAuth2ClientCredentials
impl Sync for OAuth2ClientCredentials
impl Unpin for OAuth2ClientCredentials
impl UnwindSafe for OAuth2ClientCredentials
Blanket Implementations§
§impl<T> AnyExt for T
impl<T> AnyExt for T
§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind reference§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable reference§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointer§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointer§fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
T behind Box pointer§fn downcast_move<T>(this: Self) -> Option<T>
fn downcast_move<T>(this: Self) -> Option<T>
Self to T,
useful only in generic context as a workaround for specializationSource§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,
§impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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