pub struct AuthValidator { /* private fields */ }Expand description
Authentication validator for validating entries and resolving auth information
Implementations§
Source§impl AuthValidator
impl AuthValidator
Sourcepub async fn validate_entry(
&mut self,
entry: &Entry,
auth_settings: &AuthSettings,
instance: Option<&Instance>,
) -> Result<bool>
pub async fn validate_entry( &mut self, entry: &Entry, auth_settings: &AuthSettings, instance: Option<&Instance>, ) -> Result<bool>
Validate an entry’s authentication
This method answers: “Is this entry valid?” which includes:
- Is the signature valid (or is unsigned allowed)?
- Does the signing key have permission for what this entry does?
For entries with name hints that match multiple keys, this method tries signature verification against each matching key until one succeeds.
§Returns
Ok(true)- Entry is valid (signature verified with sufficient permissions, or unsigned allowed)Ok(false)- Entry is invalid (malformed, bad signature, insufficient permissions, etc.)Err(...)- Actual error (I/O, database failures)
§Arguments
entry- The entry to validateauth_settings- Authentication settings for key lookupinstance- Instance for loading delegated trees (optional for direct keys)
Sourcepub async fn resolve_sig_key(
&mut self,
sig_key: &SigKey,
auth_settings: &AuthSettings,
instance: Option<&Instance>,
) -> Result<Vec<ResolvedAuth>>
pub async fn resolve_sig_key( &mut self, sig_key: &SigKey, auth_settings: &AuthSettings, instance: Option<&Instance>, ) -> Result<Vec<ResolvedAuth>>
Resolve authentication identifier to concrete authentication information
Returns all matching ResolvedAuth entries. For name hints that match multiple keys, all matches are returned so the caller can try signature verification against each.
§Arguments
sig_key- The signature key identifier to resolveauth_settings- Authentication settings containing auth configurationinstance- Instance for loading delegated trees (required for Delegation sig_key)
Sourcepub fn check_permissions(
&self,
resolved: &ResolvedAuth,
operation: &Operation,
) -> Result<bool>
pub fn check_permissions( &self, resolved: &ResolvedAuth, operation: &Operation, ) -> Result<bool>
Check if a resolved authentication has sufficient permissions for an operation
Sourcepub fn clear_cache(&mut self)
pub fn clear_cache(&mut self)
Clear the authentication cache
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AuthValidator
impl RefUnwindSafe for AuthValidator
impl Send for AuthValidator
impl Sync for AuthValidator
impl Unpin for AuthValidator
impl UnwindSafe for AuthValidator
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<T> CompatExt for T
impl<T> CompatExt for 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>
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 more