pub enum Credential {
ApiKey {
key: String,
},
Hmac {
key_id: String,
secret: String,
},
Jwt {
issuer: String,
audiences: Vec<String>,
},
Mtls {
fingerprint: Option<String>,
subject: Option<String>,
},
}Expand description
One authenticator bound to a consumer: API key, JWT issuer/audience binding, mTLS client-certificate match, or HMAC signing key (DW-036).
Debug is manual (DW-045): the api-key and hmac-secret values are
SECRET and a derived impl would print them — this keeps the config
tree safe to Debug-log as a whole (Gateway and every holder derive
Debug over this type).
Variants§
ApiKey
Fields
key: StringThe API key; hashed at rest by the state layer, never logged.
Either the value INLINE (accepted, but redacted to a
${redacted:...} placeholder in every config echo — admin
GET /config, DW-045) or a reference resolved at
config-compile time: ${ENV_NAME} (an environment variable)
or ${file:/path/to/secret} (one trailing newline trimmed).
References are re-read on every reload; an unresolvable
reference fails validation naming this field.
Hmac
HMAC request-signing credential (DW-036): the consumer presents
per-request signatures over the canonical string documented in
the security::authn module docs, carried in the
X-Dwara-Signature header family. Unlike API keys the secret
cannot be hash-at-rest stored — recomputing an HMAC needs the
RAW key bytes — so this credential is config-declared only (the
state store’s hashed rows cannot serve it) and the resolved
bytes live solely in the authenticator’s memory, zeroized on
drop. The pepper (#124) deliberately does NOT apply here: it
guards stored hashes, and there is no stored hash to guard.
Fields
key_id: StringPublic key identifier: the X-Dwara-Key-Id header value the
client presents to SELECT this credential (the AWS
access-key-id shape — it names the key, it is not secret).
Non-empty visible ASCII, at most 128 bytes; unique across
every consumer (validation rejects duplicates — an ambiguous
selector cannot pick a consumer deterministically).
secret: StringThe HMAC-SHA256 signing secret. INLINE values are accepted
(redacted in every config echo, like api keys) but
${ENV_NAME} / ${file:/path/to/secret} references are the
recommended shape; resolved at config-compile time and
re-read on every reload. Must be non-empty; use at least 32
bytes of entropy (shorter keys weaken the MAC construction
— documented, not enforced, the same posture as the pepper).
Jwt
Mtls
Fields
fingerprint: Option<String>SHA-256 fingerprint (lowercase hex of the DER) of the client
certificate. Optional when subject is set (#124); a
fingerprint match binds the credential to ONE exact
certificate (a re-issued cert needs a new credential).
subject: Option<String>Subject CommonName of the client certificate (#124): the
credential matches any verified client certificate whose
subject CN is exactly this string (case-sensitive). Binding
by subject survives certificate re-issue under the same CN;
the certificate must still chain to a listener’s
client_ca_file (or be otherwise verified) at the TLS layer
— the matcher only maps an ALREADY-VERIFIED certificate to a
consumer. Exactly one of subject / fingerprint must be
set (validation rejects both-empty and both-set).
Trait Implementations§
Source§impl Clone for Credential
impl Clone for Credential
Source§fn clone(&self) -> Credential
fn clone(&self) -> Credential
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Credential
impl Debug for Credential
Source§impl<'de> Deserialize<'de> for Credential
impl<'de> Deserialize<'de> for Credential
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 Credential
impl JsonSchema for Credential
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 Credential
impl PartialEq for Credential
Source§impl Serialize for Credential
impl Serialize for Credential
impl StructuralPartialEq for Credential
Auto Trait Implementations§
impl Freeze for Credential
impl RefUnwindSafe for Credential
impl Send for Credential
impl Sync for Credential
impl Unpin for Credential
impl UnwindSafe for Credential
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