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 (simulated).
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 (simulated).
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 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