pub struct OidcClient { /* private fields */ }Expand description
Thin wrapper around OpenID Connect provider discovery and RP interactions.
Implementations§
Source§impl OidcClient
impl OidcClient
Sourcepub async fn discover(issuer: &Url) -> Result<Self, OidcError>
pub async fn discover(issuer: &Url) -> Result<Self, OidcError>
Discovers the provider configuration and JSON Web Key Set for issuer.
Sourcepub fn set_client_credentials(
&mut self,
client_id: impl Into<String>,
client_secret: Option<String>,
) -> Result<(), OidcError>
pub fn set_client_credentials( &mut self, client_id: impl Into<String>, client_secret: Option<String>, ) -> Result<(), OidcError>
Configures the OAuth client credentials.
Sourcepub fn auth_url(
&self,
redirect: &Url,
scopes: &[&str],
) -> Result<(Url, PkceState), OidcError>
pub fn auth_url( &self, redirect: &Url, scopes: &[&str], ) -> Result<(Url, PkceState), OidcError>
Returns the authorization URL and PKCE material for the authorization code flow.
Sourcepub async fn exchange_code(
&self,
code: &str,
pkce: &PkceState,
redirect: &Url,
) -> Result<TokenSet, OidcError>
pub async fn exchange_code( &self, code: &str, pkce: &PkceState, redirect: &Url, ) -> Result<TokenSet, OidcError>
Exchanges the authorization code for tokens.
Sourcepub fn validate_id_token(
&self,
id_token: &str,
expected_nonce: &str,
) -> Result<IdClaims, OidcError>
pub fn validate_id_token( &self, id_token: &str, expected_nonce: &str, ) -> Result<IdClaims, OidcError>
Validates an ID token using the downloaded JWKS.
Sourcepub async fn refresh(&self, refresh_token: &str) -> Result<TokenSet, OidcError>
pub async fn refresh(&self, refresh_token: &str) -> Result<TokenSet, OidcError>
Refreshes an access token using the refresh token.
Trait Implementations§
Source§impl Clone for OidcClient
impl Clone for OidcClient
Source§fn clone(&self) -> OidcClient
fn clone(&self) -> OidcClient
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 OidcClient
impl RefUnwindSafe for OidcClient
impl Send for OidcClient
impl Sync for OidcClient
impl Unpin for OidcClient
impl UnwindSafe for OidcClient
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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