pub enum OAuth2Error {
Show 13 variants
ConfigMissing {
field: &'static str,
},
InvalidUrl {
field: &'static str,
reason: String,
},
CookieTemplateInvalid {
which: OAuth2CookieKind,
reason: String,
},
MissingStateCookie,
MissingPkceCookie,
ProviderReturnedError {
error: String,
description: Option<String>,
},
StateMismatch,
MissingAuthorizationCode,
TokenExchange {
message: String,
},
AccountMapping {
message: String,
},
AccountPersistence {
message: String,
},
JwtEncoding {
message: String,
},
JwtNotUtf8,
}Expand description
OAuth2-specific error type for OAuth2Gate.
This enum intentionally uses string messages for external/foreign errors to keep this module decoupled from particular HTTP or OAuth client implementations. Prefer mapping concrete errors into one of these variants at the boundary layers.
Variants§
ConfigMissing
A required configuration field is missing on the OAuth2Gate builder.
Fields
InvalidUrl
A provided URL failed validation or parsing.
Fields
CookieTemplateInvalid
A cookie template used by the OAuth2 flow failed validation.
Fields
which: OAuth2CookieKindWhich cookie template failed validation (state, pkce, or auth).
MissingStateCookie
Required state cookie is missing at callback time.
MissingPkceCookie
Required PKCE cookie is missing at callback time.
ProviderReturnedError
Provider returned an error to the callback endpoint.
Fields
StateMismatch
The state parameter from the provider did not match the stored cookie.
MissingAuthorizationCode
The provider callback did not include an authorization code.
TokenExchange
Token exchange with the provider failed.
AccountMapping
Mapping the provider token response to a domain Account failed.
AccountPersistence
Persisting or loading the account prior to JWT issuance failed.
JwtEncoding
Encoding the first‑party JWT failed.
JwtNotUtf8
The JWT produced by the encoder was not valid UTF‑8.
Implementations§
Source§impl OAuth2Error
impl OAuth2Error
Sourcepub fn invalid_url(field: &'static str, reason: impl Into<String>) -> Self
pub fn invalid_url(field: &'static str, reason: impl Into<String>) -> Self
Helper to construct an InvalidUrl error.
Helper to construct a CookieTemplateInvalid error.
Sourcepub fn provider_error(
error: impl Into<String>,
description: Option<String>,
) -> Self
pub fn provider_error( error: impl Into<String>, description: Option<String>, ) -> Self
Helper to construct a ProviderReturnedError error.
Sourcepub fn token_exchange(message: impl Into<String>) -> Self
pub fn token_exchange(message: impl Into<String>) -> Self
Helper to construct a TokenExchange error.
Sourcepub fn account_mapping(message: impl Into<String>) -> Self
pub fn account_mapping(message: impl Into<String>) -> Self
Helper to construct an AccountMapping error.
Sourcepub fn account_persistence(message: impl Into<String>) -> Self
pub fn account_persistence(message: impl Into<String>) -> Self
Helper to construct an AccountPersistence error.
Sourcepub fn jwt_encoding(message: impl Into<String>) -> Self
pub fn jwt_encoding(message: impl Into<String>) -> Self
Helper to construct a JwtEncoding error.
Trait Implementations§
Source§impl Debug for OAuth2Error
impl Debug for OAuth2Error
Source§impl Display for OAuth2Error
impl Display for OAuth2Error
Source§impl Error for OAuth2Error
impl Error for OAuth2Error
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<OAuth2Error> for Error
impl From<OAuth2Error> for Error
Source§fn from(source: OAuth2Error) -> Self
fn from(source: OAuth2Error) -> Self
Source§impl UserFriendlyError for OAuth2Error
impl UserFriendlyError for OAuth2Error
Source§fn user_message(&self) -> String
fn user_message(&self) -> String
Source§fn developer_message(&self) -> String
fn developer_message(&self) -> String
Source§fn support_code(&self) -> String
fn support_code(&self) -> String
Source§fn severity(&self) -> ErrorSeverity
fn severity(&self) -> ErrorSeverity
Source§fn suggested_actions(&self) -> Vec<String>
fn suggested_actions(&self) -> Vec<String>
Source§fn is_retryable(&self) -> bool
fn is_retryable(&self) -> bool
Auto Trait Implementations§
impl Freeze for OAuth2Error
impl RefUnwindSafe for OAuth2Error
impl Send for OAuth2Error
impl Sync for OAuth2Error
impl Unpin for OAuth2Error
impl UnwindSafe for OAuth2Error
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> 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> Pointable for T
impl<T> Pointable for T
Source§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.