pub struct AuthManager { /* private fields */ }Expand description
Authentication manager for coordinating multiple authentication providers
Implementations§
Source§impl AuthManager
impl AuthManager
Sourcepub fn new(config: AuthConfig) -> Self
pub fn new(config: AuthConfig) -> Self
Create a new authentication manager
Sourcepub async fn add_provider(&self, provider: Arc<dyn AuthProvider>)
pub async fn add_provider(&self, provider: Arc<dyn AuthProvider>)
Add an authentication provider
Sourcepub async fn remove_provider(&self, name: &str) -> bool
pub async fn remove_provider(&self, name: &str) -> bool
Remove an authentication provider
Sourcepub async fn list_providers(&self) -> Vec<String>
pub async fn list_providers(&self) -> Vec<String>
List available providers
Sourcepub async fn authenticate(
&self,
provider_name: &str,
credentials: AuthCredentials,
) -> McpResult<AuthContext>
pub async fn authenticate( &self, provider_name: &str, credentials: AuthCredentials, ) -> McpResult<AuthContext>
Authenticate user with credentials
Sourcepub async fn validate_token(
&self,
token: &str,
provider_name: Option<&str>,
) -> McpResult<AuthContext>
pub async fn validate_token( &self, token: &str, provider_name: Option<&str>, ) -> McpResult<AuthContext>
Validate token and get authentication context
Sourcepub async fn get_session(&self, session_id: &str) -> Option<AuthContext>
pub async fn get_session(&self, session_id: &str) -> Option<AuthContext>
Get session by ID
Sourcepub async fn revoke_session(&self, session_id: &str) -> McpResult<()>
pub async fn revoke_session(&self, session_id: &str) -> McpResult<()>
Revoke session
Sourcepub fn check_permission(&self, context: &AuthContext, permission: &str) -> bool
pub fn check_permission(&self, context: &AuthContext, permission: &str) -> bool
Check if user has permission
Sourcepub fn check_role(&self, context: &AuthContext, role: &str) -> bool
pub fn check_role(&self, context: &AuthContext, role: &str) -> bool
Check if user has role
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AuthManager
impl !RefUnwindSafe for AuthManager
impl Send for AuthManager
impl Sync for AuthManager
impl Unpin for AuthManager
impl !UnwindSafe for AuthManager
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