pub struct OAuth2Service { /* private fields */ }Expand description
OAuth2 authentication service
Implementations§
Source§impl OAuth2Service
impl OAuth2Service
Sourcepub fn new(config: OAuth2Config) -> Self
pub fn new(config: OAuth2Config) -> Self
Create new OAuth2 service
Generate authorization URL for OAuth2 flow
Sourcepub async fn exchange_code_for_token(
&self,
code: &str,
state: &str,
redirect_uri: &str,
) -> Result<OAuth2Token>
pub async fn exchange_code_for_token( &self, code: &str, state: &str, redirect_uri: &str, ) -> Result<OAuth2Token>
Exchange authorization code for access token
Sourcepub async fn get_user_info(&self, access_token: &str) -> Result<OIDCUserInfo>
pub async fn get_user_info(&self, access_token: &str) -> Result<OIDCUserInfo>
Get user information from OIDC userinfo endpoint
Sourcepub async fn authenticate(&self, access_token: &str) -> Result<AuthResult>
pub async fn authenticate(&self, access_token: &str) -> Result<AuthResult>
Authenticate user using OAuth2/OIDC
Sourcepub async fn refresh_token(&self, refresh_token: &str) -> Result<OAuth2Token>
pub async fn refresh_token(&self, refresh_token: &str) -> Result<OAuth2Token>
Refresh access token
Sourcepub async fn cleanup_expired(&self)
pub async fn cleanup_expired(&self)
Cleanup expired states
Trait Implementations§
Source§impl Clone for OAuth2Service
impl Clone for OAuth2Service
Source§fn clone(&self) -> OAuth2Service
fn clone(&self) -> OAuth2Service
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for OAuth2Service
impl !RefUnwindSafe for OAuth2Service
impl Send for OAuth2Service
impl Sync for OAuth2Service
impl Unpin for OAuth2Service
impl !UnwindSafe for OAuth2Service
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