pub struct Client<TE, TR, TIR, RT, TRE, HasAuthUrl = EndpointNotSet, HasDeviceAuthUrl = EndpointNotSet, HasIntrospectionUrl = EndpointNotSet, HasRevocationUrl = EndpointNotSet, HasTokenUrl = EndpointNotSet>where
TE: ErrorResponse,
TR: TokenResponse,
TIR: TokenIntrospectionResponse,
RT: RevocableToken,
TRE: ErrorResponse,
HasAuthUrl: EndpointState,
HasDeviceAuthUrl: EndpointState,
HasIntrospectionUrl: EndpointState,
HasRevocationUrl: EndpointState,
HasTokenUrl: EndpointState,{ /* private fields */ }
Expand description
Stores the configuration for an OAuth2 client.
This type implements the
Builder Pattern together with
typestates to encode whether
certain fields have been set that are prerequisites to certain authentication flows. For
example, the authorization endpoint must be set via set_auth_uri()
before authorize_url()
can be called. Each endpoint has a
corresponding generic type
parameter (e.g., HasAuthUrl
) used to statically enforce these dependencies. These generics
are set automatically by the corresponding setter functions, and in most cases user code should
not need to deal with them directly.
In addition to unconditional setters (e.g., set_auth_uri()
), each
endpoint has a corresponding conditional setter (e.g.,
set_auth_uri_option()
) that sets a
conditional typestate (EndpointMaybeSet
). When the conditional typestate is set, endpoints
can be used via fallible methods that return ConfigurationError::MissingUrl
if an
endpoint has not been set. This is useful in dynamic scenarios such as
OpenID Connect Discovery, in which
it cannot be determined until runtime whether an endpoint is configured.
§Error Types
To enable compile time verification that only the correct and complete set of errors for the Client
function being
invoked are exposed to the caller, the Client
type is specialized on multiple implementations of the
ErrorResponse
trait. The exact ErrorResponse
implementation returned varies by the RFC that the invoked
Client
function implements:
- Generic type
TE
(aka Token Error) for errors defined by RFC 6749 OAuth 2.0 Authorization Framework. - Generic type
TRE
(aka Token Revocation Error) for errors defined by RFC 7009 OAuth 2.0 Token Revocation.
For example when revoking a token, error code unsupported_token_type
(from RFC 7009) may be returned:
let res = client
.revoke_token(AccessToken::new("some token".to_string()).into())
.unwrap()
.request(&http_client);
assert!(matches!(res, Err(
RequestTokenError::ServerResponse(err)) if matches!(err.error(),
RevocationErrorResponseType::UnsupportedTokenType)));
§Examples
See the crate root documentation for usage examples.
Implementations§
Source§impl<TE, TR, TIR, RT, TRE> Client<TE, TR, TIR, RT, TRE, EndpointNotSet, EndpointNotSet, EndpointNotSet, EndpointNotSet, EndpointNotSet>where
TE: ErrorResponse + 'static,
TR: TokenResponse,
TIR: TokenIntrospectionResponse,
RT: RevocableToken,
TRE: ErrorResponse + 'static,
impl<TE, TR, TIR, RT, TRE> Client<TE, TR, TIR, RT, TRE, EndpointNotSet, EndpointNotSet, EndpointNotSet, EndpointNotSet, EndpointNotSet>where
TE: ErrorResponse + 'static,
TR: TokenResponse,
TIR: TokenIntrospectionResponse,
RT: RevocableToken,
TRE: ErrorResponse + 'static,
Source§impl<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, HasIntrospectionUrl, HasRevocationUrl, HasTokenUrl> Client<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, HasIntrospectionUrl, HasRevocationUrl, HasTokenUrl>where
TE: ErrorResponse + 'static,
TR: TokenResponse,
TIR: TokenIntrospectionResponse,
RT: RevocableToken,
TRE: ErrorResponse + 'static,
HasAuthUrl: EndpointState,
HasDeviceAuthUrl: EndpointState,
HasIntrospectionUrl: EndpointState,
HasRevocationUrl: EndpointState,
HasTokenUrl: EndpointState,
impl<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, HasIntrospectionUrl, HasRevocationUrl, HasTokenUrl> Client<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, HasIntrospectionUrl, HasRevocationUrl, HasTokenUrl>where
TE: ErrorResponse + 'static,
TR: TokenResponse,
TIR: TokenIntrospectionResponse,
RT: RevocableToken,
TRE: ErrorResponse + 'static,
HasAuthUrl: EndpointState,
HasDeviceAuthUrl: EndpointState,
HasIntrospectionUrl: EndpointState,
HasRevocationUrl: EndpointState,
HasTokenUrl: EndpointState,
Sourcepub fn set_auth_type(self, auth_type: AuthType) -> Self
pub fn set_auth_type(self, auth_type: AuthType) -> Self
Set the type of client authentication used for communicating with the authorization server.
The default is to use HTTP Basic authentication, as recommended in
Section 2.3.1 of RFC 6749. Note that
if a client secret is omitted (i.e., set_client_secret()
is not
called), AuthType::RequestBody
is used regardless of the auth_type
passed to
this function.
Sourcepub fn set_auth_uri(
self,
auth_url: AuthUrl,
) -> Client<TE, TR, TIR, RT, TRE, EndpointSet, HasDeviceAuthUrl, HasIntrospectionUrl, HasRevocationUrl, HasTokenUrl>
pub fn set_auth_uri( self, auth_url: AuthUrl, ) -> Client<TE, TR, TIR, RT, TRE, EndpointSet, HasDeviceAuthUrl, HasIntrospectionUrl, HasRevocationUrl, HasTokenUrl>
Set the authorization endpoint.
The client uses the authorization endpoint to obtain authorization from the resource owner via user-agent redirection. This URL is used in all standard OAuth2 flows except the Resource Owner Password Credentials Grant and the Client Credentials Grant.
Sourcepub fn set_auth_uri_option(
self,
auth_url: Option<AuthUrl>,
) -> Client<TE, TR, TIR, RT, TRE, EndpointMaybeSet, HasDeviceAuthUrl, HasIntrospectionUrl, HasRevocationUrl, HasTokenUrl>
pub fn set_auth_uri_option( self, auth_url: Option<AuthUrl>, ) -> Client<TE, TR, TIR, RT, TRE, EndpointMaybeSet, HasDeviceAuthUrl, HasIntrospectionUrl, HasRevocationUrl, HasTokenUrl>
Conditionally set the authorization endpoint.
The client uses the authorization endpoint to obtain authorization from the resource owner via user-agent redirection. This URL is used in all standard OAuth2 flows except the Resource Owner Password Credentials Grant and the Client Credentials Grant.
Sourcepub fn set_client_secret(self, client_secret: ClientSecret) -> Self
pub fn set_client_secret(self, client_secret: ClientSecret) -> Self
Set the client secret.
A client secret is generally used for confidential (i.e., server-side) OAuth2 clients and omitted from public (browser or native app) OAuth2 clients (see RFC 8252).
Set the RFC 8628 device authorization endpoint used for the Device Authorization Flow.
Conditionally set the RFC 8628 device authorization endpoint used for the Device Authorization Flow.
Sourcepub fn set_introspection_url(
self,
introspection_url: IntrospectionUrl,
) -> Client<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, EndpointSet, HasRevocationUrl, HasTokenUrl>
pub fn set_introspection_url( self, introspection_url: IntrospectionUrl, ) -> Client<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, EndpointSet, HasRevocationUrl, HasTokenUrl>
Set the RFC 7662 introspection endpoint.
See introspect()
.
Sourcepub fn set_introspection_url_option(
self,
introspection_url: Option<IntrospectionUrl>,
) -> Client<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, EndpointMaybeSet, HasRevocationUrl, HasTokenUrl>
pub fn set_introspection_url_option( self, introspection_url: Option<IntrospectionUrl>, ) -> Client<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, EndpointMaybeSet, HasRevocationUrl, HasTokenUrl>
Conditionally set the RFC 7662 introspection endpoint.
See introspect()
.
Sourcepub fn set_redirect_uri(self, redirect_url: RedirectUrl) -> Self
pub fn set_redirect_uri(self, redirect_url: RedirectUrl) -> Self
Set the redirect URL used by the authorization endpoint.
Sourcepub fn set_revocation_url(
self,
revocation_url: RevocationUrl,
) -> Client<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, HasIntrospectionUrl, EndpointSet, HasTokenUrl>
pub fn set_revocation_url( self, revocation_url: RevocationUrl, ) -> Client<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, HasIntrospectionUrl, EndpointSet, HasTokenUrl>
Set the RFC 7009 revocation endpoint.
See revoke_token()
.
Sourcepub fn set_revocation_url_option(
self,
revocation_url: Option<RevocationUrl>,
) -> Client<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, HasIntrospectionUrl, EndpointMaybeSet, HasTokenUrl>
pub fn set_revocation_url_option( self, revocation_url: Option<RevocationUrl>, ) -> Client<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, HasIntrospectionUrl, EndpointMaybeSet, HasTokenUrl>
Conditionally set the RFC 7009 revocation endpoint.
See revoke_token()
.
Sourcepub fn set_token_uri(
self,
token_url: TokenUrl,
) -> Client<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, HasIntrospectionUrl, HasRevocationUrl, EndpointSet>
pub fn set_token_uri( self, token_url: TokenUrl, ) -> Client<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, HasIntrospectionUrl, HasRevocationUrl, EndpointSet>
Set the token endpoint.
The client uses the token endpoint to exchange an authorization code for an access token, typically with client authentication. This URL is used in all standard OAuth2 flows except the Implicit Grant.
Sourcepub fn set_token_uri_option(
self,
token_url: Option<TokenUrl>,
) -> Client<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, HasIntrospectionUrl, HasRevocationUrl, EndpointMaybeSet>
pub fn set_token_uri_option( self, token_url: Option<TokenUrl>, ) -> Client<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, HasIntrospectionUrl, HasRevocationUrl, EndpointMaybeSet>
Conditionally set the token endpoint.
The client uses the token endpoint to exchange an authorization code for an access token, typically with client authentication. This URL is used in all standard OAuth2 flows except the Implicit Grant.
Sourcepub fn auth_type(&self) -> &AuthType
pub fn auth_type(&self) -> &AuthType
Return the type of client authentication used for communicating with the authorization server.
Sourcepub fn redirect_uri(&self) -> Option<&RedirectUrl>
pub fn redirect_uri(&self) -> Option<&RedirectUrl>
Return the redirect URL used by the authorization endpoint.
Source§impl<TE, TR, TIR, RT, TRE, HasDeviceAuthUrl, HasIntrospectionUrl, HasRevocationUrl, HasTokenUrl> Client<TE, TR, TIR, RT, TRE, EndpointSet, HasDeviceAuthUrl, HasIntrospectionUrl, HasRevocationUrl, HasTokenUrl>where
TE: ErrorResponse + 'static,
TR: TokenResponse,
TIR: TokenIntrospectionResponse,
RT: RevocableToken,
TRE: ErrorResponse + 'static,
HasDeviceAuthUrl: EndpointState,
HasIntrospectionUrl: EndpointState,
HasRevocationUrl: EndpointState,
HasTokenUrl: EndpointState,
impl<TE, TR, TIR, RT, TRE, HasDeviceAuthUrl, HasIntrospectionUrl, HasRevocationUrl, HasTokenUrl> Client<TE, TR, TIR, RT, TRE, EndpointSet, HasDeviceAuthUrl, HasIntrospectionUrl, HasRevocationUrl, HasTokenUrl>where
TE: ErrorResponse + 'static,
TR: TokenResponse,
TIR: TokenIntrospectionResponse,
RT: RevocableToken,
TRE: ErrorResponse + 'static,
HasDeviceAuthUrl: EndpointState,
HasIntrospectionUrl: EndpointState,
HasRevocationUrl: EndpointState,
HasTokenUrl: EndpointState,
Methods requiring an authorization endpoint.
Generate an authorization URL for a new authorization request.
Requires set_auth_uri()
to have been previously
called to set the authorization endpoint.
§Arguments
state_fn
- A function that returns an opaque value used by the client to maintain state between the request and callback. The authorization server includes this value when redirecting the user-agent back to the client.
§Security Warning
Callers should use a fresh, unpredictable state
for each authorization request and verify
that this value matches the state
parameter passed by the authorization server to the
redirect URI. Doing so mitigates
Cross-Site Request Forgery
attacks. To disable CSRF protections (NOT recommended), use insecure::authorize_url
instead.
Source§impl<TE, TR, TIR, RT, TRE, HasDeviceAuthUrl, HasIntrospectionUrl, HasRevocationUrl, HasTokenUrl> Client<TE, TR, TIR, RT, TRE, EndpointMaybeSet, HasDeviceAuthUrl, HasIntrospectionUrl, HasRevocationUrl, HasTokenUrl>where
TE: ErrorResponse + 'static,
TR: TokenResponse,
TIR: TokenIntrospectionResponse,
RT: RevocableToken,
TRE: ErrorResponse + 'static,
HasDeviceAuthUrl: EndpointState,
HasIntrospectionUrl: EndpointState,
HasRevocationUrl: EndpointState,
HasTokenUrl: EndpointState,
impl<TE, TR, TIR, RT, TRE, HasDeviceAuthUrl, HasIntrospectionUrl, HasRevocationUrl, HasTokenUrl> Client<TE, TR, TIR, RT, TRE, EndpointMaybeSet, HasDeviceAuthUrl, HasIntrospectionUrl, HasRevocationUrl, HasTokenUrl>where
TE: ErrorResponse + 'static,
TR: TokenResponse,
TIR: TokenIntrospectionResponse,
RT: RevocableToken,
TRE: ErrorResponse + 'static,
HasDeviceAuthUrl: EndpointState,
HasIntrospectionUrl: EndpointState,
HasRevocationUrl: EndpointState,
HasTokenUrl: EndpointState,
Methods with a possibly-set authorization endpoint.
Generate an authorization URL for a new authorization request.
Requires set_auth_uri_option()
to have been previously
called to set the authorization endpoint.
§Arguments
state_fn
- A function that returns an opaque value used by the client to maintain state between the request and callback. The authorization server includes this value when redirecting the user-agent back to the client.
§Security Warning
Callers should use a fresh, unpredictable state
for each authorization request and verify
that this value matches the state
parameter passed by the authorization server to the
redirect URI. Doing so mitigates
Cross-Site Request Forgery
attacks. To disable CSRF protections (NOT recommended), use insecure::authorize_url
instead.
Source§impl<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, HasIntrospectionUrl, HasRevocationUrl> Client<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, HasIntrospectionUrl, HasRevocationUrl, EndpointSet>where
TE: ErrorResponse + 'static,
TR: TokenResponse,
TIR: TokenIntrospectionResponse,
RT: RevocableToken,
TRE: ErrorResponse + 'static,
HasAuthUrl: EndpointState,
HasDeviceAuthUrl: EndpointState,
HasIntrospectionUrl: EndpointState,
HasRevocationUrl: EndpointState,
impl<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, HasIntrospectionUrl, HasRevocationUrl> Client<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, HasIntrospectionUrl, HasRevocationUrl, EndpointSet>where
TE: ErrorResponse + 'static,
TR: TokenResponse,
TIR: TokenIntrospectionResponse,
RT: RevocableToken,
TRE: ErrorResponse + 'static,
HasAuthUrl: EndpointState,
HasDeviceAuthUrl: EndpointState,
HasIntrospectionUrl: EndpointState,
HasRevocationUrl: EndpointState,
Methods requiring a token endpoint.
Sourcepub fn exchange_client_credentials(
&self,
) -> ClientCredentialsTokenRequest<'_, TE, TR>
pub fn exchange_client_credentials( &self, ) -> ClientCredentialsTokenRequest<'_, TE, TR>
Request an access token using the Client Credentials Flow.
Requires set_token_uri()
to have been previously
called to set the token endpoint.
Sourcepub fn exchange_code(
&self,
code: AuthorizationCode,
) -> CodeTokenRequest<'_, TE, TR>
pub fn exchange_code( &self, code: AuthorizationCode, ) -> CodeTokenRequest<'_, TE, TR>
Exchange a code returned during the Authorization Code Flow for an access token.
Acquires ownership of the code
because authorization codes may only be used once to
retrieve an access token from the authorization server.
Requires set_token_uri()
to have been previously
called to set the token endpoint.
Sourcepub fn exchange_device_access_token<'a, EF>(
&'a self,
auth_response: &'a DeviceAuthorizationResponse<EF>,
) -> DeviceAccessTokenRequest<'a, 'static, TR, EF>where
EF: ExtraDeviceAuthorizationFields,
pub fn exchange_device_access_token<'a, EF>(
&'a self,
auth_response: &'a DeviceAuthorizationResponse<EF>,
) -> DeviceAccessTokenRequest<'a, 'static, TR, EF>where
EF: ExtraDeviceAuthorizationFields,
Exchange an RFC 8628 Device Authorization
Response returned by exchange_device_code()
for an access
token.
Requires set_token_uri()
to have been previously
called to set the token endpoint.
Sourcepub fn exchange_password<'a>(
&'a self,
username: &'a ResourceOwnerUsername,
password: &'a ResourceOwnerPassword,
) -> PasswordTokenRequest<'a, TE, TR>
pub fn exchange_password<'a>( &'a self, username: &'a ResourceOwnerUsername, password: &'a ResourceOwnerPassword, ) -> PasswordTokenRequest<'a, TE, TR>
Request an access token using the Resource Owner Password Credentials Flow.
Requires
set_token_uri()
to have
been previously called to set the token endpoint.
Sourcepub fn exchange_refresh_token<'a>(
&'a self,
refresh_token: &'a RefreshToken,
) -> RefreshTokenRequest<'a, TE, TR>
pub fn exchange_refresh_token<'a>( &'a self, refresh_token: &'a RefreshToken, ) -> RefreshTokenRequest<'a, TE, TR>
Exchange a refresh token for an access token.
See https://tools.ietf.org/html/rfc6749#section-6.
Requires
set_token_uri()
to have
been previously called to set the token endpoint.
Source§impl<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, HasIntrospectionUrl, HasRevocationUrl> Client<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, HasIntrospectionUrl, HasRevocationUrl, EndpointMaybeSet>where
TE: ErrorResponse + 'static,
TR: TokenResponse,
TIR: TokenIntrospectionResponse,
RT: RevocableToken,
TRE: ErrorResponse + 'static,
HasAuthUrl: EndpointState,
HasDeviceAuthUrl: EndpointState,
HasIntrospectionUrl: EndpointState,
HasRevocationUrl: EndpointState,
impl<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, HasIntrospectionUrl, HasRevocationUrl> Client<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, HasIntrospectionUrl, HasRevocationUrl, EndpointMaybeSet>where
TE: ErrorResponse + 'static,
TR: TokenResponse,
TIR: TokenIntrospectionResponse,
RT: RevocableToken,
TRE: ErrorResponse + 'static,
HasAuthUrl: EndpointState,
HasDeviceAuthUrl: EndpointState,
HasIntrospectionUrl: EndpointState,
HasRevocationUrl: EndpointState,
Methods with a possibly-set token endpoint.
Sourcepub fn exchange_client_credentials(
&self,
) -> Result<ClientCredentialsTokenRequest<'_, TE, TR>, ConfigurationError>
pub fn exchange_client_credentials( &self, ) -> Result<ClientCredentialsTokenRequest<'_, TE, TR>, ConfigurationError>
Request an access token using the Client Credentials Flow.
Requires set_token_uri_option()
to have been previously
called to set the token endpoint.
Sourcepub fn exchange_code(
&self,
code: AuthorizationCode,
) -> Result<CodeTokenRequest<'_, TE, TR>, ConfigurationError>
pub fn exchange_code( &self, code: AuthorizationCode, ) -> Result<CodeTokenRequest<'_, TE, TR>, ConfigurationError>
Exchange a code returned during the Authorization Code Flow for an access token.
Acquires ownership of the code
because authorization codes may only be used once to
retrieve an access token from the authorization server.
Requires set_token_uri_option()
to have been previously
called to set the token endpoint.
Sourcepub fn exchange_device_access_token<'a, EF>(
&'a self,
auth_response: &'a DeviceAuthorizationResponse<EF>,
) -> Result<DeviceAccessTokenRequest<'a, 'static, TR, EF>, ConfigurationError>where
EF: ExtraDeviceAuthorizationFields,
pub fn exchange_device_access_token<'a, EF>(
&'a self,
auth_response: &'a DeviceAuthorizationResponse<EF>,
) -> Result<DeviceAccessTokenRequest<'a, 'static, TR, EF>, ConfigurationError>where
EF: ExtraDeviceAuthorizationFields,
Exchange an RFC 8628 Device Authorization
Response returned by exchange_device_code()
for an access
token.
Requires set_token_uri_option()
to have been previously
called to set the token endpoint.
Sourcepub fn exchange_password<'a>(
&'a self,
username: &'a ResourceOwnerUsername,
password: &'a ResourceOwnerPassword,
) -> Result<PasswordTokenRequest<'a, TE, TR>, ConfigurationError>
pub fn exchange_password<'a>( &'a self, username: &'a ResourceOwnerUsername, password: &'a ResourceOwnerPassword, ) -> Result<PasswordTokenRequest<'a, TE, TR>, ConfigurationError>
Request an access token using the Resource Owner Password Credentials Flow.
Requires
set_token_uri_option()
to have
been previously called to set the token endpoint.
Sourcepub fn exchange_refresh_token<'a>(
&'a self,
refresh_token: &'a RefreshToken,
) -> Result<RefreshTokenRequest<'a, TE, TR>, ConfigurationError>
pub fn exchange_refresh_token<'a>( &'a self, refresh_token: &'a RefreshToken, ) -> Result<RefreshTokenRequest<'a, TE, TR>, ConfigurationError>
Exchange a refresh token for an access token.
See https://tools.ietf.org/html/rfc6749#section-6.
Requires
set_token_uri_option()
to have
been previously called to set the token endpoint.
Source§impl<TE, TR, TIR, RT, TRE, HasAuthUrl, HasIntrospectionUrl, HasRevocationUrl, HasTokenUrl> Client<TE, TR, TIR, RT, TRE, HasAuthUrl, EndpointSet, HasIntrospectionUrl, HasRevocationUrl, HasTokenUrl>where
TE: ErrorResponse + 'static,
TR: TokenResponse,
TIR: TokenIntrospectionResponse,
RT: RevocableToken,
TRE: ErrorResponse + 'static,
HasAuthUrl: EndpointState,
HasIntrospectionUrl: EndpointState,
HasRevocationUrl: EndpointState,
HasTokenUrl: EndpointState,
impl<TE, TR, TIR, RT, TRE, HasAuthUrl, HasIntrospectionUrl, HasRevocationUrl, HasTokenUrl> Client<TE, TR, TIR, RT, TRE, HasAuthUrl, EndpointSet, HasIntrospectionUrl, HasRevocationUrl, HasTokenUrl>where
TE: ErrorResponse + 'static,
TR: TokenResponse,
TIR: TokenIntrospectionResponse,
RT: RevocableToken,
TRE: ErrorResponse + 'static,
HasAuthUrl: EndpointState,
HasIntrospectionUrl: EndpointState,
HasRevocationUrl: EndpointState,
HasTokenUrl: EndpointState,
Methods requiring a device authorization endpoint.
Sourcepub fn exchange_device_code(&self) -> DeviceAuthorizationRequest<'_, TE>
pub fn exchange_device_code(&self) -> DeviceAuthorizationRequest<'_, TE>
Begin the RFC 8628 Device Authorization Flow and retrieve a Device Authorization Response.
Requires
set_device_authorization_url()
to have
been previously called to set the device authorization endpoint.
Return the RFC 8628 device authorization endpoint used for the Device Authorization Flow.
Source§impl<TE, TR, TIR, RT, TRE, HasAuthUrl, HasIntrospectionUrl, HasRevocationUrl, HasTokenUrl> Client<TE, TR, TIR, RT, TRE, HasAuthUrl, EndpointMaybeSet, HasIntrospectionUrl, HasRevocationUrl, HasTokenUrl>where
TE: ErrorResponse + 'static,
TR: TokenResponse,
TIR: TokenIntrospectionResponse,
RT: RevocableToken,
TRE: ErrorResponse + 'static,
HasAuthUrl: EndpointState,
HasIntrospectionUrl: EndpointState,
HasRevocationUrl: EndpointState,
HasTokenUrl: EndpointState,
impl<TE, TR, TIR, RT, TRE, HasAuthUrl, HasIntrospectionUrl, HasRevocationUrl, HasTokenUrl> Client<TE, TR, TIR, RT, TRE, HasAuthUrl, EndpointMaybeSet, HasIntrospectionUrl, HasRevocationUrl, HasTokenUrl>where
TE: ErrorResponse + 'static,
TR: TokenResponse,
TIR: TokenIntrospectionResponse,
RT: RevocableToken,
TRE: ErrorResponse + 'static,
HasAuthUrl: EndpointState,
HasIntrospectionUrl: EndpointState,
HasRevocationUrl: EndpointState,
HasTokenUrl: EndpointState,
Methods with a possibly-set device authorization endpoint.
Sourcepub fn exchange_device_code(
&self,
) -> Result<DeviceAuthorizationRequest<'_, TE>, ConfigurationError>
pub fn exchange_device_code( &self, ) -> Result<DeviceAuthorizationRequest<'_, TE>, ConfigurationError>
Begin the RFC 8628 Device Authorization Flow.
Requires
set_device_authorization_url_option()
to have
been previously called to set the device authorization endpoint.
Return the RFC 8628 device authorization endpoint used for the Device Authorization Flow.
Source§impl<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, HasRevocationUrl, HasTokenUrl> Client<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, EndpointSet, HasRevocationUrl, HasTokenUrl>where
TE: ErrorResponse + 'static,
TR: TokenResponse,
TIR: TokenIntrospectionResponse,
RT: RevocableToken,
TRE: ErrorResponse + 'static,
HasAuthUrl: EndpointState,
HasDeviceAuthUrl: EndpointState,
HasRevocationUrl: EndpointState,
HasTokenUrl: EndpointState,
impl<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, HasRevocationUrl, HasTokenUrl> Client<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, EndpointSet, HasRevocationUrl, HasTokenUrl>where
TE: ErrorResponse + 'static,
TR: TokenResponse,
TIR: TokenIntrospectionResponse,
RT: RevocableToken,
TRE: ErrorResponse + 'static,
HasAuthUrl: EndpointState,
HasDeviceAuthUrl: EndpointState,
HasRevocationUrl: EndpointState,
HasTokenUrl: EndpointState,
Methods requiring an introspection endpoint.
Sourcepub fn introspect<'a>(
&'a self,
token: &'a AccessToken,
) -> IntrospectionRequest<'a, TE, TIR>
pub fn introspect<'a>( &'a self, token: &'a AccessToken, ) -> IntrospectionRequest<'a, TE, TIR>
Retrieve metadata for an access token using the
RFC 7662
introspection endpoint.
Requires set_introspection_url()
to have been previously
called to set the introspection endpoint.
Sourcepub fn introspection_url(&self) -> &IntrospectionUrl
pub fn introspection_url(&self) -> &IntrospectionUrl
Return the RFC 7662 introspection endpoint.
Source§impl<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, HasRevocationUrl, HasTokenUrl> Client<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, EndpointMaybeSet, HasRevocationUrl, HasTokenUrl>where
TE: ErrorResponse + 'static,
TR: TokenResponse,
TIR: TokenIntrospectionResponse,
RT: RevocableToken,
TRE: ErrorResponse + 'static,
HasAuthUrl: EndpointState,
HasDeviceAuthUrl: EndpointState,
HasRevocationUrl: EndpointState,
HasTokenUrl: EndpointState,
impl<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, HasRevocationUrl, HasTokenUrl> Client<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, EndpointMaybeSet, HasRevocationUrl, HasTokenUrl>where
TE: ErrorResponse + 'static,
TR: TokenResponse,
TIR: TokenIntrospectionResponse,
RT: RevocableToken,
TRE: ErrorResponse + 'static,
HasAuthUrl: EndpointState,
HasDeviceAuthUrl: EndpointState,
HasRevocationUrl: EndpointState,
HasTokenUrl: EndpointState,
Methods with a possibly-set introspection endpoint.
Sourcepub fn introspect<'a>(
&'a self,
token: &'a AccessToken,
) -> Result<IntrospectionRequest<'a, TE, TIR>, ConfigurationError>
pub fn introspect<'a>( &'a self, token: &'a AccessToken, ) -> Result<IntrospectionRequest<'a, TE, TIR>, ConfigurationError>
Retrieve metadata for an access token using the
RFC 7662
introspection endpoint.
Requires set_introspection_url_option()
to have been
previously called to set the introspection endpoint.
Sourcepub fn introspection_url(&self) -> Option<&IntrospectionUrl>
pub fn introspection_url(&self) -> Option<&IntrospectionUrl>
Return the RFC 7662 introspection endpoint.
Source§impl<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, HasIntrospectionUrl, HasTokenUrl> Client<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, HasIntrospectionUrl, EndpointSet, HasTokenUrl>where
TE: ErrorResponse + 'static,
TR: TokenResponse,
TIR: TokenIntrospectionResponse,
RT: RevocableToken,
TRE: ErrorResponse + 'static,
HasAuthUrl: EndpointState,
HasDeviceAuthUrl: EndpointState,
HasIntrospectionUrl: EndpointState,
HasTokenUrl: EndpointState,
impl<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, HasIntrospectionUrl, HasTokenUrl> Client<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, HasIntrospectionUrl, EndpointSet, HasTokenUrl>where
TE: ErrorResponse + 'static,
TR: TokenResponse,
TIR: TokenIntrospectionResponse,
RT: RevocableToken,
TRE: ErrorResponse + 'static,
HasAuthUrl: EndpointState,
HasDeviceAuthUrl: EndpointState,
HasIntrospectionUrl: EndpointState,
HasTokenUrl: EndpointState,
Methods requiring a revocation endpoint.
Sourcepub fn revoke_token(
&self,
token: RT,
) -> Result<RevocationRequest<'_, RT, TRE>, ConfigurationError>
pub fn revoke_token( &self, token: RT, ) -> Result<RevocationRequest<'_, RT, TRE>, ConfigurationError>
Revoke an access or refresh token using the RFC 7009 revocation endpoint.
Requires set_revocation_url()
to have been previously
called to set the revocation endpoint.
Sourcepub fn revocation_url(&self) -> &RevocationUrl
pub fn revocation_url(&self) -> &RevocationUrl
Return the RFC 7009 revocation endpoint.
See revoke_token()
.
Source§impl<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, HasIntrospectionUrl, HasTokenUrl> Client<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, HasIntrospectionUrl, EndpointMaybeSet, HasTokenUrl>where
TE: ErrorResponse + 'static,
TR: TokenResponse,
TIR: TokenIntrospectionResponse,
RT: RevocableToken,
TRE: ErrorResponse + 'static,
HasAuthUrl: EndpointState,
HasDeviceAuthUrl: EndpointState,
HasIntrospectionUrl: EndpointState,
HasTokenUrl: EndpointState,
impl<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, HasIntrospectionUrl, HasTokenUrl> Client<TE, TR, TIR, RT, TRE, HasAuthUrl, HasDeviceAuthUrl, HasIntrospectionUrl, EndpointMaybeSet, HasTokenUrl>where
TE: ErrorResponse + 'static,
TR: TokenResponse,
TIR: TokenIntrospectionResponse,
RT: RevocableToken,
TRE: ErrorResponse + 'static,
HasAuthUrl: EndpointState,
HasDeviceAuthUrl: EndpointState,
HasIntrospectionUrl: EndpointState,
HasTokenUrl: EndpointState,
Methods with a possible-set revocation endpoint.
Sourcepub fn revoke_token(
&self,
token: RT,
) -> Result<RevocationRequest<'_, RT, TRE>, ConfigurationError>
pub fn revoke_token( &self, token: RT, ) -> Result<RevocationRequest<'_, RT, TRE>, ConfigurationError>
Revoke an access or refresh token using the RFC 7009 revocation endpoint.
Requires set_revocation_url_option()
to have been
previously called to set the revocation endpoint.
Sourcepub fn revocation_url(&self) -> Option<&RevocationUrl>
pub fn revocation_url(&self) -> Option<&RevocationUrl>
Return the RFC 7009 revocation endpoint.
See revoke_token()
.