pub struct TokenInfo {
pub token: TokenValue,
pub login_id: Arc<str>,
pub login_type: Arc<str>,
pub create_time: DateTime<Utc>,
pub last_active_time: DateTime<Utc>,
pub expire_time: Option<DateTime<Utc>>,
pub device: Option<String>,
pub extra_data: Option<Value>,
pub nonce: Option<String>,
pub refresh_token: Option<String>,
pub refresh_token_expire_time: Option<DateTime<Utc>>,
pub active_timeout_override: Option<i64>,
}Expand description
Token 信息 | Token Information
存储 Token 的完整信息,包括元数据和安全特性 Stores complete token information, including metadata and security features
§字段说明 | Field Description
token: Token 值 | Token valuelogin_id: 登录用户 ID | Logged-in user IDlogin_type: 登录类型(如 “user”, “admin”)| Login type (e.g., “user”, “admin”)create_time: Token 创建时间 | Token creation timelast_active_time: 最后活跃时间 | Last active timeexpire_time: 过期时间(None 表示永不过期)| Expiration time (None means never expires)device: 设备标识 | Device identifierextra_data: 额外数据 | Extra datanonce: 防重放攻击的一次性令牌 | One-time token for replay attack preventionrefresh_token: 用于刷新的长期令牌 | Long-term token for refreshrefresh_token_expire_time: Refresh Token 过期时间 | Refresh token expiration time
Fields§
§token: TokenValueToken 值 | Token value
login_id: Arc<str>登录 ID(Arc 共享,避免请求内多次 Clone 拷贝字节) Login ID (Arc-shared to avoid copying bytes on request-path clones)
login_type: Arc<str>登录类型(默认体系经 intern_login_type 复用同一 Arc)
Login type (default systems reuse one Arc via intern_login_type)
create_time: DateTime<Utc>Token 创建时间 | Token creation time
last_active_time: DateTime<Utc>Token 最后活跃时间 | Token last active time
expire_time: Option<DateTime<Utc>>Token 过期时间(None 表示永不过期)| Token expiration time (None means never expires)
device: Option<String>设备标识 | Device identifier
extra_data: Option<Value>额外数据 | Extra data
nonce: Option<String>Nonce(用于防重放攻击)| Nonce (for replay attack prevention)
refresh_token: Option<String>Refresh Token(用于刷新访问令牌)| Refresh Token (for refreshing access token)
refresh_token_expire_time: Option<DateTime<Utc>>Refresh Token 过期时间 | Refresh Token expiration time
active_timeout_override: Option<i64>Per-token idle timeout (seconds). Used only when dynamic_active_timeout is on.
单 token 闲置超时(秒)。仅 dynamic_active_timeout 打开时使用。
Implementations§
Source§impl TokenInfo
impl TokenInfo
Sourcepub fn new(token: TokenValue, login_id: impl AsRef<str>) -> TokenInfo
pub fn new(token: TokenValue, login_id: impl AsRef<str>) -> TokenInfo
Create a new instance | 创建新实例
Sourcepub fn effective_active_timeout(&self, config: &SaTokenConfig) -> i64
pub fn effective_active_timeout(&self, config: &SaTokenConfig) -> i64
Idle limit actually used for freeze checks. 冻结检查实际使用的闲置上限。
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
is_expired — is expired | is_expired
Sourcepub fn update_active_time(&mut self)
pub fn update_active_time(&mut self)
update_active_time — update active time | update_active_time
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TokenInfo
impl<'de> Deserialize<'de> for TokenInfo
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<TokenInfo, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<TokenInfo, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for TokenInfo
impl Serialize for TokenInfo
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for TokenInfo
impl RefUnwindSafe for TokenInfo
impl Send for TokenInfo
impl Sync for TokenInfo
impl Unpin for TokenInfo
impl UnsafeUnpin for TokenInfo
impl UnwindSafe for TokenInfo
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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 more