pub struct SecurityValidator { /* private fields */ }Expand description
Security Validator
Validates callback requests from external services. Manages token generation, validation, and rate limiting.
Implementations§
Source§impl SecurityValidator
impl SecurityValidator
Sourcepub fn with_config(config: SecurityConfig) -> Self
pub fn with_config(config: SecurityConfig) -> Self
Create a new security validator with configuration
Sourcepub async fn generate_token(
&self,
service_id: ServiceId,
request_id: String,
allowed_types: Vec<String>,
) -> Result<String, SecurityError>
pub async fn generate_token( &self, service_id: ServiceId, request_id: String, allowed_types: Vec<String>, ) -> Result<String, SecurityError>
Generate a new token for a callback request
Sourcepub async fn validate(
&self,
token: &str,
service_id: &ServiceId,
request_id: &str,
callback_type: &str,
) -> ValidationResult
pub async fn validate( &self, token: &str, service_id: &ServiceId, request_id: &str, callback_type: &str, ) -> ValidationResult
Validate a callback request
Sourcepub async fn invalidate_token(&self, token: &str) -> Result<(), SecurityError>
pub async fn invalidate_token(&self, token: &str) -> Result<(), SecurityError>
Invalidate a token
Sourcepub async fn invalidate_service_tokens(&self, service_id: &ServiceId)
pub async fn invalidate_service_tokens(&self, service_id: &ServiceId)
Invalidate all tokens for a service
Sourcepub async fn cleanup_expired(&self) -> usize
pub async fn cleanup_expired(&self) -> usize
Clean up expired tokens
Sourcepub async fn token_count(&self) -> usize
pub async fn token_count(&self) -> usize
Get active token count
Sourcepub async fn get_token_info(&self, token: &str) -> Option<TokenInfo>
pub async fn get_token_info(&self, token: &str) -> Option<TokenInfo>
Get token info
Auto Trait Implementations§
impl !RefUnwindSafe for SecurityValidator
impl !UnwindSafe for SecurityValidator
impl Freeze for SecurityValidator
impl Send for SecurityValidator
impl Sync for SecurityValidator
impl Unpin for SecurityValidator
impl UnsafeUnpin for SecurityValidator
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