pub struct Jwt(/* private fields */);
Expand description
A JSON Web Token for authenticating with the server.
This struct represents a JSON Web Token (JWT) that can be used for authentication purposes. It is important to note that this implementation provide some security measures to protect the token:
- the debug implementation just prints
Jwt(REDACTED)
, Display
is not implemented so you can’t call.to_string()
on it
You can still have access to the token string using either
as_insecure_token
or into_insecure_token
functions.
However, you should take care to ensure that only authorized users have access to the JWT.
For example:
- it can be stored in a secure cookie,
- stored in a database with restricted access,
- or encrypted in conjunction with other encryption mechanisms.
Implementations§
Source§impl Jwt
impl Jwt
Sourcepub fn as_insecure_token(&self) -> &str
pub fn as_insecure_token(&self) -> &str
Returns the underlying token string.
⚠️: It is important to note that the token should be handled securely and protected from unauthorized access.
Sourcepub fn into_insecure_token(self) -> String
pub fn into_insecure_token(self) -> String
Returns the underlying token string.
⚠️: It is important to note that the token should be handled securely and protected from unauthorized access.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Jwt
impl<'de> Deserialize<'de> for Jwt
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Credentials<Signin, Jwt> for Database<'_>
impl Credentials<Signin, Jwt> for Namespace<'_>
impl Credentials<Signin, Jwt> for Root<'_>
impl<T, P> Credentials<T, Jwt> for Record<'_, P>where
P: Serialize,
Auto Trait Implementations§
impl Freeze for Jwt
impl RefUnwindSafe for Jwt
impl Send for Jwt
impl Sync for Jwt
impl Unpin for Jwt
impl UnwindSafe for Jwt
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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 more