pub struct RUser {
pub id: String,
pub token: String,
}Expand description
An authenticated request context extracted from actix-web.
If extraction succeeds, id is the user id previously passed to
RTokenManager::login, and token is the original token from the request.
The token is read from Authorization header. Both of the following formats
are accepted:
Authorization: <token>Authorization: Bearer <token>
§繁體中文
由 actix-web 自動抽取的已驗證使用者上下文。
Extractor 成功時:
id會是先前傳給RTokenManager::login的使用者 idtoken會是請求中帶來的 token 原文
token 會從 Authorization header 讀取,支援以下格式:
Authorization: <token>Authorization: Bearer <token>
Fields§
§id: String§token: StringTrait Implementations§
Source§impl FromRequest for RUser
Available on crate feature actix only.Extracts RUser from an actix-web request.
impl FromRequest for RUser
Available on crate feature
actix only.Extracts RUser from an actix-web request.
Failure modes:
- 500: manager is missing from
app_data, or mutex is poisoned - 401: token is missing, invalid, or expired
§繁體中文
從 actix-web 請求中抽取 RUser。
失敗情況:
- 500:
app_data中找不到管理器,或 mutex poisoned - 401:token 缺失、無效、或已過期
Auto Trait Implementations§
impl Freeze for RUser
impl RefUnwindSafe for RUser
impl Send for RUser
impl Sync for RUser
impl Unpin for RUser
impl UnwindSafe for RUser
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