pub struct AuthManager {
pub token_store: Box<dyn TokenStore>,
/* private fields */
}Expand description
Manager for authentication.
Fields§
§token_store: Box<dyn TokenStore>Token store
Implementations§
Source§impl AuthManager
impl AuthManager
Sourcepub fn new(
config: WebullConfig,
token_store: Box<dyn TokenStore>,
client: Client,
) -> Self
pub fn new( config: WebullConfig, token_store: Box<dyn TokenStore>, client: Client, ) -> Self
Create a new authentication manager.
Sourcepub async fn authenticate(
&mut self,
username: &str,
password: &str,
) -> WebullResult<AccessToken>
pub async fn authenticate( &mut self, username: &str, password: &str, ) -> WebullResult<AccessToken>
Authenticate with username and password.
Sourcepub async fn multi_factor_auth(
&mut self,
mfa_code: &str,
) -> WebullResult<AccessToken>
pub async fn multi_factor_auth( &mut self, mfa_code: &str, ) -> WebullResult<AccessToken>
Handle multi-factor authentication.
Sourcepub async fn refresh_token(&mut self) -> WebullResult<AccessToken>
pub async fn refresh_token(&mut self) -> WebullResult<AccessToken>
Refresh the access token.
Sourcepub async fn get_token(&self) -> WebullResult<AccessToken>
pub async fn get_token(&self) -> WebullResult<AccessToken>
Get the current access token.
Sourcepub async fn revoke_token(&mut self) -> WebullResult<()>
pub async fn revoke_token(&mut self) -> WebullResult<()>
Revoke the current token.
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