pub enum AuthLayer {
Disabled,
ApiKey(Arc<ApiKeyStore>),
ReloadableApiKey {
store: Arc<ApiKeyStore>,
path: PathBuf,
},
}Expand description
What the auth layer needs to validate requests. Built once at startup and shared across Axum workers.
Variants§
Implementations§
Source§impl AuthLayer
impl AuthLayer
Sourcepub fn from_config(
cfg: &AuthConfig,
allow_loopback_bypass: bool,
) -> Result<Self, String>
pub fn from_config( cfg: &AuthConfig, allow_loopback_bypass: bool, ) -> Result<Self, String>
Build from the configured mode.
Sourcepub fn reloadable_key_store(&self) -> Option<(PathBuf, Arc<ApiKeyStore>)>
pub fn reloadable_key_store(&self) -> Option<(PathBuf, Arc<ApiKeyStore>)>
Return the key-store source used by the standalone lifecycle so it can watch and atomically reload operator rotations/revocations.
Sourcepub fn authenticate_bearer(
&self,
authorization: Option<&str>,
required_scope: &str,
require_identity: bool,
) -> Result<Option<AuthenticatedIdentity>, AuthenticationFailure>
pub fn authenticate_bearer( &self, authorization: Option<&str>, required_scope: &str, require_identity: bool, ) -> Result<Option<AuthenticatedIdentity>, AuthenticationFailure>
Authenticate non-HTTP transports using the same scope and identity requirements as the AuthZEN HTTP endpoints.
Sourcepub async fn authenticate_bearer_async(
&self,
authorization: Option<&str>,
required_scope: &str,
require_identity: bool,
) -> Result<Option<AuthenticatedIdentity>, AuthenticationFailure>
pub async fn authenticate_bearer_async( &self, authorization: Option<&str>, required_scope: &str, require_identity: bool, ) -> Result<Option<AuthenticatedIdentity>, AuthenticationFailure>
Authenticate without running the memory-hard hash on a Tokio worker. Saturation fails fast so hostile traffic cannot build an unbounded queue of expensive password-hash jobs.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AuthLayer
impl !RefUnwindSafe for AuthLayer
impl Send for AuthLayer
impl Sync for AuthLayer
impl Unpin for AuthLayer
impl !UnwindSafe for AuthLayer
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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>
Converts
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>
Converts
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 moreSource§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