pub struct AuthMode {
pub api_key: bool,
pub jwt: Option<JwtConfig>,
}Expand description
Auth configuration for the engine’s HTTP API.
Both authentication methods (JWT and API key) can be enabled at the same time. When both are enabled, the middleware dispatches on token shape — tokens that parse as a JWS header are validated as JWTs, everything else is validated as an API key. This lets the same server accept long-lived machine API keys alongside short-lived OIDC-issued user tokens without the caller picking a mode up front.
Fields§
§api_key: boolAPI-key authentication enabled. When true, Bearer tokens that are not
JWT-shaped are validated against the api_keys table.
jwt: Option<JwtConfig>JWT authentication enabled. When set, Bearer tokens that parse as a JWS header are validated against the issuer’s JWKS.
Implementations§
Source§impl AuthMode
impl AuthMode
Sourcepub fn jwt(issuer: String, audience: Option<String>) -> Self
pub fn jwt(issuer: String, audience: Option<String>) -> Self
JWT/OIDC only. Tokens are validated against the issuer’s JWKS.
Sourcepub fn combined(issuer: String, audience: Option<String>) -> Self
pub fn combined(issuer: String, audience: Option<String>) -> Self
Both JWT and API key. Tokens that parse as JWTs take the JWT path; everything else takes the API-key path.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
True if any authentication method is enabled.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AuthMode
impl !RefUnwindSafe for AuthMode
impl Send for AuthMode
impl Sync for AuthMode
impl Unpin for AuthMode
impl UnsafeUnpin for AuthMode
impl !UnwindSafe for AuthMode
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<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