pub struct OAuth2Flow<P: OAuthProvider, M: UserMapper = ()> { /* private fields */ }Expand description
Orchestrates the Authorization Code flow.
Implementations§
Source§impl<P: OAuthProvider> OAuth2Flow<P, ()>
impl<P: OAuthProvider> OAuth2Flow<P, ()>
Source§impl<P: OAuthProvider, M: UserMapper> OAuth2Flow<P, M>
impl<P: OAuthProvider, M: UserMapper> OAuth2Flow<P, M>
pub fn with_mapper(provider: P, mapper: M) -> Self
Sourcepub fn initiate_login(
&self,
scopes: &[&str],
pkce_challenge: Option<&str>,
) -> (String, String)
pub fn initiate_login( &self, scopes: &[&str], pkce_challenge: Option<&str>, ) -> (String, String)
Generates the redirect URL and CSRF state.
Sourcepub async fn finalize_login(
&self,
code: &str,
received_state: &str,
expected_state: &str,
pkce_verifier: Option<&str>,
) -> Result<(Identity, OAuthToken, Option<M::LocalUser>), AuthError>
pub async fn finalize_login( &self, code: &str, received_state: &str, expected_state: &str, pkce_verifier: Option<&str>, ) -> Result<(Identity, OAuthToken, Option<M::LocalUser>), AuthError>
Completes the flow by exchanging the code. If a mapper is provided, it will also map the identity to a local user.
Sourcepub async fn refresh_access_token(
&self,
refresh_token: &str,
) -> Result<OAuthToken, AuthError>
pub async fn refresh_access_token( &self, refresh_token: &str, ) -> Result<OAuthToken, AuthError>
Refresh an access token using a refresh token.
Auto Trait Implementations§
impl<P, M> Freeze for OAuth2Flow<P, M>
impl<P, M> RefUnwindSafe for OAuth2Flow<P, M>where
P: RefUnwindSafe,
M: RefUnwindSafe,
impl<P, M> Send for OAuth2Flow<P, M>
impl<P, M> Sync for OAuth2Flow<P, M>
impl<P, M> Unpin for OAuth2Flow<P, M>
impl<P, M> UnwindSafe for OAuth2Flow<P, M>where
P: UnwindSafe,
M: UnwindSafe,
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