pub struct OAuthService<U: UserRepository, O: OAuthRepository> { /* private fields */ }
Expand description
Service for OAuth authentication operations
Implementations§
Source§impl<U: UserRepository, O: OAuthRepository> OAuthService<U, O>
impl<U: UserRepository, O: OAuthRepository> OAuthService<U, O>
Sourcepub fn new(user_repository: Arc<U>, oauth_repository: Arc<O>) -> Self
pub fn new(user_repository: Arc<U>, oauth_repository: Arc<O>) -> Self
Create a new OAuthService with the given repositories
Sourcepub async fn get_or_create_user(
&self,
provider: &str,
subject: &str,
email: &str,
name: Option<String>,
) -> Result<User, Error>
pub async fn get_or_create_user( &self, provider: &str, subject: &str, email: &str, name: Option<String>, ) -> Result<User, Error>
Create or get a user from OAuth provider information
Sourcepub async fn link_account(
&self,
user_id: &UserId,
provider: &str,
subject: &str,
) -> Result<(), Error>
pub async fn link_account( &self, user_id: &UserId, provider: &str, subject: &str, ) -> Result<(), Error>
Link an existing user to an OAuth account
Sourcepub async fn store_pkce_verifier(
&self,
csrf_state: &str,
pkce_verifier: &str,
expires_in: Duration,
) -> Result<(), Error>
pub async fn store_pkce_verifier( &self, csrf_state: &str, pkce_verifier: &str, expires_in: Duration, ) -> Result<(), Error>
Store a PKCE verifier
Sourcepub async fn get_pkce_verifier(
&self,
csrf_state: &str,
) -> Result<Option<String>, Error>
pub async fn get_pkce_verifier( &self, csrf_state: &str, ) -> Result<Option<String>, Error>
Get and consume a PKCE verifier
Sourcepub async fn get_account(
&self,
provider: &str,
subject: &str,
) -> Result<Option<OAuthAccount>, Error>
pub async fn get_account( &self, provider: &str, subject: &str, ) -> Result<Option<OAuthAccount>, Error>
Get OAuth account information
Auto Trait Implementations§
impl<U, O> Freeze for OAuthService<U, O>
impl<U, O> RefUnwindSafe for OAuthService<U, O>where
O: RefUnwindSafe,
U: RefUnwindSafe,
impl<U, O> Send for OAuthService<U, O>
impl<U, O> Sync for OAuthService<U, O>
impl<U, O> Unpin for OAuthService<U, O>
impl<U, O> UnwindSafe for OAuthService<U, O>where
O: RefUnwindSafe,
U: RefUnwindSafe,
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