RUser

Struct RUser 

Source
pub struct RUser {
    pub id: String,
    pub token: String,
}
Expand description

§日本語

actix-web / axum から抽出される認証済みユーザーコンテキストです。

抽出が成功した場合:

  • idRTokenManager::login に渡したユーザー ID
  • token はリクエストに含まれていた token の生文字列

token は Authorization header から読み取ります。次の形式に対応します:

  • Authorization: <token>
  • Authorization: Bearer <token>

§English

An authenticated request context extracted from actix-web / axum.

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>

Fields§

§id: String

§日本語

token に紐づくユーザー ID。

§English

The user id associated with the token.

§token: String

§日本語

リクエストに含まれていた token の生文字列。

§English

The raw token string from the request.

Trait Implementations§

Source§

impl Debug for RUser

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FromRequest for RUser

Available on crate feature actix only.
§日本語

actix-web のリクエストから RUser を抽出します。

失敗時:

  • 500:app_data にマネージャが無い、または mutex が poisoned
  • 401:token が無い/無効/期限切れ
§English

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
Source§

type Error = Error

The associated error which can be returned.
Source§

type Future = Pin<Box<dyn Future<Output = Result<RUser, <RUser as FromRequest>::Error>>>>

Future that resolves to a Self. Read more
Source§

fn from_request(req: &HttpRequest, _payload: &mut Payload) -> Self::Future

Create a Self from request parts asynchronously.
Source§

fn extract(req: &HttpRequest) -> Self::Future

Create a Self from request head asynchronously. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more