pub struct AuthenticationError<C: Challenge> { /* private fields */ }
Expand description
Authentication error returned by authentication extractors.
Different extractors may extend AuthenticationError
implementation in order to provide access
inner challenge fields.
Implementations
sourceimpl AuthenticationError<Bearer>
impl AuthenticationError<Bearer>
Extended error customization for HTTP Bearer
auth.
sourcepub fn with_error(self, kind: Error) -> Self
pub fn with_error(self, kind: Error) -> Self
Attach Error
to the current Authentication error.
Error status code will be changed to the one provided by the kind
Error.
sourcepub fn with_error_description<T>(self, desc: T) -> Selfwhere
T: Into<Cow<'static, str>>,
pub fn with_error_description<T>(self, desc: T) -> Selfwhere
T: Into<Cow<'static, str>>,
Attach error description to the current Authentication error.
sourcepub fn with_error_uri<T>(self, uri: T) -> Selfwhere
T: Into<Cow<'static, str>>,
pub fn with_error_uri<T>(self, uri: T) -> Selfwhere
T: Into<Cow<'static, str>>,
Attach error URI to the current Authentication error.
It is up to implementor to provide properly formed absolute URI.
sourceimpl<C: Challenge> AuthenticationError<C>
impl<C: Challenge> AuthenticationError<C>
sourcepub fn new(challenge: C) -> AuthenticationError<C>
pub fn new(challenge: C) -> AuthenticationError<C>
Creates new authentication error from the provided challenge
.
By default returned error will resolve into the HTTP 401
status code.
sourcepub fn challenge_mut(&mut self) -> &mut C
pub fn challenge_mut(&mut self) -> &mut C
Returns mutable reference to the inner challenge instance.
sourcepub fn status_code_mut(&mut self) -> &mut StatusCode
pub fn status_code_mut(&mut self) -> &mut StatusCode
Returns mutable reference to the inner status code.
Can be used to override returned status code, but by default this lib tries to stick to the RFC, so it might be unreasonable.