pub struct UnifiedAuthManager { /* private fields */ }Expand description
Unified authentication manager that wraps exchange-specific implementations
Implementations§
Source§impl UnifiedAuthManager
impl UnifiedAuthManager
Sourcepub fn new(
exchange_name: impl Into<SmartString>,
adapter: Arc<dyn AuthenticationManager>,
) -> Self
pub fn new( exchange_name: impl Into<SmartString>, adapter: Arc<dyn AuthenticationManager>, ) -> Self
Create a new unified authentication manager
Sourcepub const fn with_cache_validity(self, duration: Duration) -> Self
pub const fn with_cache_validity(self, duration: Duration) -> Self
Set cache validity duration
Sourcepub fn clear_cache(&self)
pub fn clear_cache(&self)
Clear all caches
Sourcepub fn create_rest_context(
&self,
method: &str,
path: &str,
body: Option<&str>,
) -> AuthenticationContext
pub fn create_rest_context( &self, method: &str, path: &str, body: Option<&str>, ) -> AuthenticationContext
Create a standard REST context for simple cases
Sourcepub async fn authenticate_simple_rest(
&self,
method: &str,
path: &str,
body: Option<&str>,
) -> Result<HeaderMap>
pub async fn authenticate_simple_rest( &self, method: &str, path: &str, body: Option<&str>, ) -> Result<HeaderMap>
Authenticate a simple REST request (convenience method)
Sourcepub fn get_auth_stats(&self) -> AuthenticationStats
pub fn get_auth_stats(&self) -> AuthenticationStats
Get authentication statistics
Trait Implementations§
Source§impl AuthenticationManager for UnifiedAuthManager
impl AuthenticationManager for UnifiedAuthManager
Source§fn authenticate_rest_request<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 AuthenticationContext,
) -> Pin<Box<dyn Future<Output = Result<AuthenticationResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn authenticate_rest_request<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 AuthenticationContext,
) -> Pin<Box<dyn Future<Output = Result<AuthenticationResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Generate authentication for a REST API request
Source§fn authenticate_websocket<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<AuthenticationResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn authenticate_websocket<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<AuthenticationResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Generate authentication for a WebSocket connection
Source§fn authenticate_websocket_trading<'life0, 'async_trait>(
&'life0 self,
timestamp: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<AuthenticationResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn authenticate_websocket_trading<'life0, 'async_trait>(
&'life0 self,
timestamp: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<AuthenticationResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Generate WebSocket trading authentication (if supported)
Source§fn is_authentication_valid(&self) -> bool
fn is_authentication_valid(&self) -> bool
Check if authentication is still valid
Source§fn time_until_expiration(&self) -> Option<Duration>
fn time_until_expiration(&self) -> Option<Duration>
Get the time until authentication expires (if applicable)
Source§fn refresh_authentication<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn refresh_authentication<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Refresh authentication if needed (for JWT-based exchanges)
Source§fn exchange_name(&self) -> &str
fn exchange_name(&self) -> &str
Get the exchange name
Source§fn supports_websocket_trading(&self) -> bool
fn supports_websocket_trading(&self) -> bool
Check if this authentication supports WebSocket trading
Source§fn requires_refresh(&self) -> bool
fn requires_refresh(&self) -> bool
Check if this authentication requires periodic refresh
Source§fn refresh_interval(&self) -> Option<Duration>
fn refresh_interval(&self) -> Option<Duration>
Get refresh interval (if applicable)
Auto Trait Implementations§
impl Freeze for UnifiedAuthManager
impl !RefUnwindSafe for UnifiedAuthManager
impl Send for UnifiedAuthManager
impl Sync for UnifiedAuthManager
impl Unpin for UnifiedAuthManager
impl !UnwindSafe for UnifiedAuthManager
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