#[non_exhaustive]pub enum KeySourceConfig {
Ip,
Header {
name: String,
},
JwtClaim {
claim: String,
},
}Expand description
How a rule derives its limit key. All sources fall back to the client IP when
their value is absent, so a limit can’t be bypassed by omitting a header or
authenticating anonymously. Written as a tagged map, e.g.
key: { type: jwt_claim, claim: sub }; omitting key defaults to ip.
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.
Ip
Client IP (trusted-proxy X-Forwarded-For aware). { type: ip }.
Header
Value of a named request header (e.g. an API key).
{ type: header, name: x-api-key }.
JwtClaim
Value of a claim from the validated JWT (provider-agnostic).
{ type: jwt_claim, claim: sub }.
Trait Implementations§
Source§impl Clone for KeySourceConfig
impl Clone for KeySourceConfig
Source§fn clone(&self) -> KeySourceConfig
fn clone(&self) -> KeySourceConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for KeySourceConfig
impl Debug for KeySourceConfig
Source§impl Default for KeySourceConfig
impl Default for KeySourceConfig
Source§fn default() -> KeySourceConfig
fn default() -> KeySourceConfig
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for KeySourceConfig
impl<'de> Deserialize<'de> for KeySourceConfig
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for KeySourceConfig
Source§impl PartialEq for KeySourceConfig
impl PartialEq for KeySourceConfig
impl StructuralPartialEq for KeySourceConfig
Auto Trait Implementations§
impl Freeze for KeySourceConfig
impl RefUnwindSafe for KeySourceConfig
impl Send for KeySourceConfig
impl Sync for KeySourceConfig
impl Unpin for KeySourceConfig
impl UnsafeUnpin for KeySourceConfig
impl UnwindSafe for KeySourceConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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
Compare self to
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request