pub struct Token {
pub token: String,
pub token_type: String,
pub expires_at: Option<Instant>,
pub metadata: Option<HashMap<String, String>>,
}Expand description
Represents an auth token.
Fields§
§token: StringThe actual token string.
This is the value used in Authorization: header.
token_type: StringThe type of the token.
The most common type is "Bearer" but other types may appear in the
future.
expires_at: Option<Instant>The instant at which the token expires.
If None, the token does not expire.
Note that the Instant is not valid across processes. It is
recommended to let the authentication library refresh tokens within a
process instead of handling expirations yourself. If you do need to
copy an expiration across processes, consider converting it to a
time::OffsetDateTime first:
expires_at.map(|i| time::OffsetDateTime::now_utc() + (i - std::time::Instant::now()));metadata: Option<HashMap<String, String>>Optional metadata associated with the token.
This might include information like granted scopes or other claims.
Trait Implementations§
impl StructuralPartialEq for Token
Auto Trait Implementations§
impl Freeze for Token
impl RefUnwindSafe for Token
impl Send for Token
impl Sync for Token
impl Unpin for Token
impl UnwindSafe for Token
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