pub struct OAuth2Authenticator { /* private fields */ }Expand description
OAuth2 authenticator for external identity providers.
Implementations§
Source§impl OAuth2Authenticator
impl OAuth2Authenticator
Sourcepub fn new(config: OAuth2Config) -> Self
pub fn new(config: OAuth2Config) -> Self
Create a new OAuth2 authenticator.
Generate authorization URL for OAuth2 flow.
Sourcepub fn verify_state(&self, state: &str) -> bool
pub fn verify_state(&self, state: &str) -> bool
Verify state parameter.
Sourcepub fn exchange_code(&self, code: &str) -> Result<OAuth2TokenResponse, String>
pub fn exchange_code(&self, code: &str) -> Result<OAuth2TokenResponse, String>
Exchange authorization code for tokens using real HTTP request.
Sourcepub fn get_user_info(
&self,
access_token: &str,
) -> Result<OAuth2UserInfo, String>
pub fn get_user_info( &self, access_token: &str, ) -> Result<OAuth2UserInfo, String>
Get user info from OAuth2 provider using real HTTP request.
Sourcepub fn determine_role(&self, roles: &[String]) -> UserRole
pub fn determine_role(&self, roles: &[String]) -> UserRole
Determine role from OAuth2 claims.
Auto Trait Implementations§
impl !Freeze for OAuth2Authenticator
impl !RefUnwindSafe for OAuth2Authenticator
impl Send for OAuth2Authenticator
impl Sync for OAuth2Authenticator
impl Unpin for OAuth2Authenticator
impl UnsafeUnpin for OAuth2Authenticator
impl !UnwindSafe for OAuth2Authenticator
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more