Trait ApiKeyValidator

Source
pub trait ApiKeyValidator: Send + Sync {
    // Required methods
    fn validate_key<'life0, 'life1, 'async_trait>(
        &'life0 self,
        api_key: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<UserInfo>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn create_key<'life0, 'life1, 'async_trait>(
        &'life0 self,
        user_id: &'life1 str,
        expires_in: Option<Duration>,
    ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn revoke_key<'life0, 'life1, 'async_trait>(
        &'life0 self,
        api_key: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Trait for API key validation.

Required Methods§

Source

fn validate_key<'life0, 'life1, 'async_trait>( &'life0 self, api_key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<UserInfo>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Validate an API key and return associated user info.

Source

fn create_key<'life0, 'life1, 'async_trait>( &'life0 self, user_id: &'life1 str, expires_in: Option<Duration>, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create a new API key for a user.

Source

fn revoke_key<'life0, 'life1, 'async_trait>( &'life0 self, api_key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Revoke an API key.

Implementors§