pub struct Claims {
pub login_id: String,
pub exp: Option<i64>,
pub iat: Option<i64>,
pub jti: Option<String>,
pub iss: Option<String>,
pub aud: Option<String>,
pub login_type: Option<String>,
pub extra: HashMap<String, Value>,
}Expand description
JWT Claims(与 sa-token JwtClaims 兼容)
网关和所有微服务共用此结构解码 JWT。
ms-auth 通过 sa-token 的 JwtClaims.extra 注入 tenant_id、username 等。
Fields§
§login_id: String用户 ID(sa-token 的 login_id)
exp: Option<i64>过期时间(Unix 时间戳,秒)
iat: Option<i64>签发时间(Unix 时间戳,秒)
jti: Option<String>JWT ID(唯一标识符)
iss: Option<String>签发者
aud: Option<String>受众
login_type: Option<String>登录类型
extra: HashMap<String, Value>扩展字段(tenant_id, username, token_type 等业务字段)
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Claims
impl<'de> Deserialize<'de> for Claims
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
Auto Trait Implementations§
impl Freeze for Claims
impl RefUnwindSafe for Claims
impl Send for Claims
impl Sync for Claims
impl Unpin for Claims
impl UnsafeUnpin for Claims
impl UnwindSafe for Claims
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