pub struct MicrosoftAuth { /* private fields */ }Expand description
Microsoft authenticator using Device Code Flow.
Implementations§
Source§impl MicrosoftAuth
impl MicrosoftAuth
Sourcepub fn new(client_id: impl Into<String>) -> Self
pub fn new(client_id: impl Into<String>) -> Self
Creates a new Microsoft authenticator from an Azure AD client ID.
Sourcepub fn set_device_code_callback<F>(&mut self, callback: F)
pub fn set_device_code_callback<F>(&mut self, callback: F)
Set a callback that receives (code, verification_url) for the user.
Sourcepub fn set_poll_interval(&mut self, interval: Duration)
pub fn set_poll_interval(&mut self, interval: Duration)
Set the polling interval (default 5 seconds).
Sourcepub fn set_timeout(&mut self, timeout: Duration)
pub fn set_timeout(&mut self, timeout: Duration)
Set the authentication timeout (default 5 minutes).
Sourcepub async fn authenticate_with_refresh_token(
&mut self,
refresh_token: &SecretString,
) -> AuthResult<UserProfile>
pub async fn authenticate_with_refresh_token( &mut self, refresh_token: &SecretString, ) -> AuthResult<UserProfile>
Silent re-authentication using a stored MS refresh token.
Returns AuthError::InvalidToken if the refresh token has expired
(~90 days of inactivity) or been revoked; caller should then fall
back to Authenticator::authenticate.
Trait Implementations§
Source§impl Authenticator for MicrosoftAuth
impl Authenticator for MicrosoftAuth
Source§async fn authenticate(&mut self) -> AuthResult<UserProfile>
async fn authenticate(&mut self) -> AuthResult<UserProfile>
Authenticate a user and return their profile.
Source§fn verify(
&self,
token: &str,
) -> impl Future<Output = AuthResult<UserProfile>> + Send
fn verify( &self, token: &str, ) -> impl Future<Output = AuthResult<UserProfile>> + Send
Verify if a token is still valid.
Auto Trait Implementations§
impl Freeze for MicrosoftAuth
impl !RefUnwindSafe for MicrosoftAuth
impl Send for MicrosoftAuth
impl Sync for MicrosoftAuth
impl Unpin for MicrosoftAuth
impl UnsafeUnpin for MicrosoftAuth
impl !UnwindSafe for MicrosoftAuth
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