pub struct OAuthError {
pub code: String,
pub description: String,
pub status: u16,
}
Expand description
OAuth error types for both authorization requests and token responses
Fields§
§code: String
Error code (e.g., “invalid_request”, “invalid_client”, etc.)
description: String
Human-readable error description
status: u16
HTTP status code for the error
Implementations§
Source§impl OAuthError
impl OAuthError
Sourcepub fn new(
code: impl Into<String>,
description: impl Into<String>,
status: u16,
) -> Self
pub fn new( code: impl Into<String>, description: impl Into<String>, status: u16, ) -> Self
Create a new OAuth error
Sourcepub fn invalid_request(description: impl Into<String>) -> Self
pub fn invalid_request(description: impl Into<String>) -> Self
Create an invalid_request error
Sourcepub fn invalid_client(description: impl Into<String>) -> Self
pub fn invalid_client(description: impl Into<String>) -> Self
Create an invalid_client error
Sourcepub fn invalid_grant(description: impl Into<String>) -> Self
pub fn invalid_grant(description: impl Into<String>) -> Self
Create an invalid_grant error
Create an unauthorized_client error
Sourcepub fn unsupported_grant_type(description: impl Into<String>) -> Self
pub fn unsupported_grant_type(description: impl Into<String>) -> Self
Create an unsupported_grant_type error
Sourcepub fn unsupported_response_type(description: impl Into<String>) -> Self
pub fn unsupported_response_type(description: impl Into<String>) -> Self
Create an unsupported_response_type error
Sourcepub fn invalid_scope(description: impl Into<String>) -> Self
pub fn invalid_scope(description: impl Into<String>) -> Self
Create an invalid_scope error
Sourcepub fn invalid_token(description: impl Into<String>) -> Self
pub fn invalid_token(description: impl Into<String>) -> Self
Create an invalid_token error
Sourcepub fn insufficient_scope(description: impl Into<String>) -> Self
pub fn insufficient_scope(description: impl Into<String>) -> Self
Create an insufficient_scope error
Create an unauthorized error
Sourcepub fn server_error(description: impl Into<String>) -> Self
pub fn server_error(description: impl Into<String>) -> Self
Create a server_error
Sourcepub fn serialization_error(description: impl Into<String>) -> Self
pub fn serialization_error(description: impl Into<String>) -> Self
Create a serialization error
Sourcepub fn invalid_client_metadata(description: impl Into<String>) -> Self
pub fn invalid_client_metadata(description: impl Into<String>) -> Self
Create an invalid_client_metadata error (for client registration)
Sourcepub fn access_denied(description: impl Into<String>) -> Self
pub fn access_denied(description: impl Into<String>) -> Self
Create an access_denied error (for authorization flow)
Sourcepub fn invalid_redirect_uri(description: impl Into<String>) -> Self
pub fn invalid_redirect_uri(description: impl Into<String>) -> Self
Create an invalid_redirect_uri error
Create a temporarily_unavailable error
Sourcepub fn method_not_allowed(description: impl Into<String>) -> Self
pub fn method_not_allowed(description: impl Into<String>) -> Self
Create a method_not_allowed error
Sourcepub fn payload_too_large(description: impl Into<String>) -> Self
pub fn payload_too_large(description: impl Into<String>) -> Self
Create a payload_too_large error
Sourcepub fn not_implemented(description: impl Into<String>) -> Self
pub fn not_implemented(description: impl Into<String>) -> Self
Create a not_implemented error
Sourcepub fn to_token_error(&self) -> TokenErrorResponse
pub fn to_token_error(&self) -> TokenErrorResponse
Convert to token endpoint error format for serialization
Sourcepub fn www_authenticate_header(&self) -> Option<String>
pub fn www_authenticate_header(&self) -> Option<String>
Get the WWW-Authenticate header value for 401 responses
Sourcepub fn with_headers(
self,
headers: HashMap<String, String>,
) -> OAuthErrorWithHeaders
pub fn with_headers( self, headers: HashMap<String, String>, ) -> OAuthErrorWithHeaders
Create an error response with optional custom headers
Trait Implementations§
Source§impl Clone for OAuthError
impl Clone for OAuthError
Source§fn clone(&self) -> OAuthError
fn clone(&self) -> OAuthError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for OAuthError
impl Debug for OAuthError
Source§impl<'de> Deserialize<'de> for OAuthError
impl<'de> Deserialize<'de> for OAuthError
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for OAuthError
impl Display for OAuthError
Source§impl Error for OAuthError
impl Error for OAuthError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl From<ClientManagerError> for OAuthError
impl From<ClientManagerError> for OAuthError
Source§fn from(error: ClientManagerError) -> Self
fn from(error: ClientManagerError) -> Self
Source§impl From<Error> for OAuthError
impl From<Error> for OAuthError
Source§impl From<OAuthError> for AuthorizationErrorResponse
impl From<OAuthError> for AuthorizationErrorResponse
Source§fn from(oauth_error: OAuthError) -> Self
fn from(oauth_error: OAuthError) -> Self
Source§impl From<OAuthError> for OAuthErrorResponse
impl From<OAuthError> for OAuthErrorResponse
Source§fn from(error: OAuthError) -> Self
fn from(error: OAuthError) -> Self
Source§impl From<OAuthError> for TokenErrorResponse
impl From<OAuthError> for TokenErrorResponse
Source§fn from(oauth_error: OAuthError) -> Self
fn from(oauth_error: OAuthError) -> Self
Source§impl IntoResponse for OAuthError
Error handling for axum responses
impl IntoResponse for OAuthError
Error handling for axum responses
Source§fn into_response(self) -> Response
fn into_response(self) -> Response
Auto Trait Implementations§
impl Freeze for OAuthError
impl RefUnwindSafe for OAuthError
impl Send for OAuthError
impl Sync for OAuthError
impl Unpin for OAuthError
impl UnwindSafe for OAuthError
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, S> Handler<IntoResponseHandler, S> for T
impl<T, S> Handler<IntoResponseHandler, S> for T
Source§fn call(
self,
_req: Request<Body>,
_state: S,
) -> <T as Handler<IntoResponseHandler, S>>::Future
fn call( self, _req: Request<Body>, _state: S, ) -> <T as Handler<IntoResponseHandler, S>>::Future
Source§fn layer<L>(self, layer: L) -> Layered<L, Self, T, S>where
L: Layer<HandlerService<Self, T, S>> + Clone,
<L as Layer<HandlerService<Self, T, S>>>::Service: Service<Request<Body>>,
fn layer<L>(self, layer: L) -> Layered<L, Self, T, S>where
L: Layer<HandlerService<Self, T, S>> + Clone,
<L as Layer<HandlerService<Self, T, S>>>::Service: Service<Request<Body>>,
tower::Layer
to the handler. Read moreSource§fn with_state(self, state: S) -> HandlerService<Self, T, S>
fn with_state(self, state: S) -> HandlerService<Self, T, S>
Service
by providing the stateSource§impl<H, T> HandlerWithoutStateExt<T> for H
impl<H, T> HandlerWithoutStateExt<T> for H
Source§fn into_service(self) -> HandlerService<H, T, ()>
fn into_service(self) -> HandlerService<H, T, ()>
Service
and no state.Source§fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>
fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>
MakeService
and no state. Read moreSource§fn into_make_service_with_connect_info<C>(
self,
) -> IntoMakeServiceWithConnectInfo<HandlerService<H, T, ()>, C>
fn into_make_service_with_connect_info<C>( self, ) -> IntoMakeServiceWithConnectInfo<HandlerService<H, T, ()>, C>
MakeService
which stores information
about the incoming connection and has no state. Read moreSource§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>
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>
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 moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.