pub struct ApiKeyProvider { /* private fields */ }
Expand description
API Key authentication provider
Implementations§
Source§impl ApiKeyProvider
impl ApiKeyProvider
Sourcepub async fn add_api_key(&self, key: String, user_info: UserInfo)
pub async fn add_api_key(&self, key: String, user_info: UserInfo)
Add an API key
Sourcepub async fn remove_api_key(&self, key: &str) -> bool
pub async fn remove_api_key(&self, key: &str) -> bool
Remove an API key
Sourcepub async fn list_api_keys(&self) -> Vec<String>
pub async fn list_api_keys(&self) -> Vec<String>
List all API keys (returns keys only, not full info for security)
Trait Implementations§
Source§impl AuthProvider for ApiKeyProvider
impl AuthProvider for ApiKeyProvider
Source§fn provider_type(&self) -> AuthProviderType
fn provider_type(&self) -> AuthProviderType
Provider type
Source§fn authenticate<'life0, 'async_trait>(
&'life0 self,
credentials: AuthCredentials,
) -> Pin<Box<dyn Future<Output = McpResult<AuthContext>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn authenticate<'life0, 'async_trait>(
&'life0 self,
credentials: AuthCredentials,
) -> Pin<Box<dyn Future<Output = McpResult<AuthContext>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Authenticate user with credentials
Source§fn validate_token<'life0, 'life1, 'async_trait>(
&'life0 self,
token: &'life1 str,
) -> Pin<Box<dyn Future<Output = McpResult<AuthContext>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn validate_token<'life0, 'life1, 'async_trait>(
&'life0 self,
token: &'life1 str,
) -> Pin<Box<dyn Future<Output = McpResult<AuthContext>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Validate existing token/session
Source§fn refresh_token<'life0, 'life1, 'async_trait>(
&'life0 self,
_refresh_token: &'life1 str,
) -> Pin<Box<dyn Future<Output = McpResult<TokenInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn refresh_token<'life0, 'life1, 'async_trait>(
&'life0 self,
_refresh_token: &'life1 str,
) -> Pin<Box<dyn Future<Output = McpResult<TokenInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Refresh access token
Auto Trait Implementations§
impl Freeze for ApiKeyProvider
impl !RefUnwindSafe for ApiKeyProvider
impl Send for ApiKeyProvider
impl Sync for ApiKeyProvider
impl Unpin for ApiKeyProvider
impl !UnwindSafe for ApiKeyProvider
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