pub trait AuthProvider:
Debug
+ Send
+ Sync {
// Required methods
fn login<'life0, 'life1, 'async_trait>(
&'life0 self,
token: Option<&'life1 str>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn logout<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn status<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<AuthStatus>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn token<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Required Methods§
Sourcefn login<'life0, 'life1, 'async_trait>(
&'life0 self,
token: Option<&'life1 str>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn login<'life0, 'life1, 'async_trait>(
&'life0 self,
token: Option<&'life1 str>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
执行登录流程(交互式或非交互式)。
如果提供了 token,则使用 token 进行非交互式登录;
否则启动交互式登录流程。
登录成功后凭据会被持久化到本地存储。
§Errors
当认证失败或凭据存储失败时返回错误。
Sourcefn logout<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn logout<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".