pub struct OpenIDClient {
pub config: OpenIDConfig,
pub jwks: Option<JwkSet>,
pub opts: OpenIDClientOpts,
}Expand description
OpenID client
Fields§
§config: OpenIDConfig§jwks: Option<JwkSet>§opts: OpenIDClientOptsImplementations§
Source§impl OpenIDClient
impl OpenIDClient
Sourcepub async fn new(
config: OpenIDConfig,
jwks: Option<JwkSet>,
opts: &OpenIDClientOpts,
) -> Self
pub async fn new( config: OpenIDConfig, jwks: Option<JwkSet>, opts: &OpenIDClientOpts, ) -> Self
Construct an OpenID client by give hard-coded configuration values
Sourcepub async fn new_from_url(
url: &str,
opts: &OpenIDClientOpts,
) -> Result<Self, OpenIdError>
pub async fn new_from_url( url: &str, opts: &OpenIDClientOpts, ) -> Result<Self, OpenIdError>
Construct an OpenID client by loading configuration from a given .well-known/openid-configuration URL
Get the authorization URL where a user should be redirect to perform authentication
Sourcepub async fn request_token_from_code(
&self,
code: &str,
code_verifier: Option<&str>,
) -> Result<(OpenIDTokenResponse, String), OpenIdError>
pub async fn request_token_from_code( &self, code: &str, code_verifier: Option<&str>, ) -> Result<(OpenIDTokenResponse, String), OpenIdError>
Query the token endpoint using an authorization code
Sourcepub async fn request_token_from_refresh_token(
&self,
refresh_token: &str,
) -> Result<(OpenIDTokenResponse, String), OpenIdError>
pub async fn request_token_from_refresh_token( &self, refresh_token: &str, ) -> Result<(OpenIDTokenResponse, String), OpenIdError>
Query the token endpoint using a refresh token
Sourcepub fn verify_jwt<T: DeserializeOwned>(
&self,
jwt: &str,
) -> Result<TokenData<T>, OpenIdError>
pub fn verify_jwt<T: DeserializeOwned>( &self, jwt: &str, ) -> Result<TokenData<T>, OpenIdError>
Decode & verify a JWT signature
Sourcepub async fn request_user_info(
&self,
token: &OpenIDTokenResponse,
) -> Result<(OpenIDUserInfo, String), OpenIdError>
pub async fn request_user_info( &self, token: &OpenIDTokenResponse, ) -> Result<(OpenIDUserInfo, String), OpenIdError>
Query the UserInfo endpoint.
This endpoint should be used after having successfully retrieved the token
This endpoint returns both the parsed value and the raw response, in case of presence of additional fields
Auto Trait Implementations§
impl Freeze for OpenIDClient
impl RefUnwindSafe for OpenIDClient
impl Send for OpenIDClient
impl Sync for OpenIDClient
impl Unpin for OpenIDClient
impl UnsafeUnpin for OpenIDClient
impl UnwindSafe for OpenIDClient
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