pub enum WebSocketSecurityError {
Unauthorized,
MissingOrigin,
InvalidOrigin {
origin: String,
},
MissingRole {
role: String,
},
MissingAuthority {
authority: String,
},
}Expand description
Errors that can occur during WebSocket security validation.
Variants§
The user is not authenticated.
Returned when a WebSocket upgrade request is made without valid authentication
and require_authentication is enabled.
MissingOrigin
The Origin header is missing.
For security, browsers always send an Origin header with WebSocket requests. A missing Origin header suggests a non-browser client or a security issue.
InvalidOrigin
The Origin header value is not in the allowed origins list.
This prevents Cross-Site WebSocket Hijacking (CSWSH) attacks where a malicious website tries to establish a WebSocket connection to your server using the victim’s cookies.
MissingRole
The user does not have the required role.
MissingAuthority
The user does not have the required authority.
Fields
The authority that was required
Trait Implementations§
Source§impl Debug for WebSocketSecurityError
impl Debug for WebSocketSecurityError
Source§impl Display for WebSocketSecurityError
impl Display for WebSocketSecurityError
Source§impl Error for WebSocketSecurityError
impl Error for WebSocketSecurityError
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 ResponseError for WebSocketSecurityError
impl ResponseError for WebSocketSecurityError
Source§fn status_code(&self) -> StatusCode
fn status_code(&self) -> StatusCode
Source§fn error_response(&self) -> HttpResponse
fn error_response(&self) -> HttpResponse
Auto Trait Implementations§
impl Freeze for WebSocketSecurityError
impl RefUnwindSafe for WebSocketSecurityError
impl Send for WebSocketSecurityError
impl Sync for WebSocketSecurityError
impl Unpin for WebSocketSecurityError
impl UnwindSafe for WebSocketSecurityError
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> 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.