pub struct KeyAccessControl { /* private fields */ }Expand description
Key access control
Implementations§
Source§impl KeyAccessControl
impl KeyAccessControl
pub fn new() -> Self
pub fn initialize(&mut self) -> Result<(), CryptographicError>
Sourcepub fn add_policy(&mut self, policy: AccessPolicy)
pub fn add_policy(&mut self, policy: AccessPolicy)
Register an access policy for a key.
Sourcepub fn check_permission(&self, key_id: &str, operation: KeyOperation) -> bool
pub fn check_permission(&self, key_id: &str, operation: KeyOperation) -> bool
Check whether a given operation is permitted on a key. Returns true if a policy exists that explicitly allows the operation. Deny-by-default: no matching policy means denial.
Sourcepub fn check_permission_with_context(
&self,
key_id: &str,
operation: KeyOperation,
current_hour: u8,
current_day: u8,
ip_address: &str,
) -> bool
pub fn check_permission_with_context( &self, key_id: &str, operation: KeyOperation, current_hour: u8, current_day: u8, ip_address: &str, ) -> bool
Check permission with full context (time restrictions, IP).
Sourcepub fn log_access(
&mut self,
key_id: &str,
operation: KeyOperation,
user_id: &str,
success: bool,
)
pub fn log_access( &mut self, key_id: &str, operation: KeyOperation, user_id: &str, success: bool, )
Record an access attempt in the audit log.
Sourcepub fn policy_count(&self) -> usize
pub fn policy_count(&self) -> usize
Number of registered policies.
Sourcepub fn audit_log(&self) -> &AccessAuditLog
pub fn audit_log(&self) -> &AccessAuditLog
Get a reference to the audit log.
Sourcepub fn authentication_methods(&self) -> &[AuthenticationMethod]
pub fn authentication_methods(&self) -> &[AuthenticationMethod]
Get the list of configured authentication methods.
Sourcepub fn add_authentication_method(&mut self, method: AuthenticationMethod)
pub fn add_authentication_method(&mut self, method: AuthenticationMethod)
Add an authentication method if not already present.
Sourcepub fn supports_authentication_method(
&self,
method: &AuthenticationMethod,
) -> bool
pub fn supports_authentication_method( &self, method: &AuthenticationMethod, ) -> bool
Check whether a given authentication method is supported.
Auto Trait Implementations§
impl Freeze for KeyAccessControl
impl RefUnwindSafe for KeyAccessControl
impl Send for KeyAccessControl
impl Sync for KeyAccessControl
impl Unpin for KeyAccessControl
impl UnsafeUnpin for KeyAccessControl
impl UnwindSafe for KeyAccessControl
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
Aggregate shares in an MPC protocol.
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> 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