Skip to main content

TokenBuilder

Struct TokenBuilder 

Source
pub struct TokenBuilder { /* private fields */ }
Expand description

Token 构建器 - 支持链式调用 | Token Builder - Supports chain calls

Implementations§

Source§

impl TokenBuilder

Source

pub fn new(login_id: String) -> Self

创建新的 Token 构建器 | Create new token builder

Source

pub fn extra_data(self, data: Value) -> Self

设置额外数据 | Set extra data

Source

pub fn device(self, device: impl Into<String>) -> Self

设置设备信息 | Set device info

Source

pub fn login_type(self, login_type: impl Into<String>) -> Self

设置登录类型 | Set login type

Source

pub fn nonce(self, nonce: impl Into<String>) -> Self

设置 nonce(需开启 enable_nonce) Set nonce (requires enable_nonce)

Source

pub fn expire_at(self, expire_time: DateTime<Utc>) -> Self

设置绝对过期时间 / Set absolute expiration

Source

pub fn expire_at_unix(self, unix_seconds: i64) -> Self

设置 Unix 秒级绝对过期时间 / Set absolute expiration from Unix seconds

Source

pub fn expire_time(self, expire_time: DateTime<Utc>) -> Self

👎Deprecated:

use expire_at()

Alias of Self::expire_at. Self::expire_at 的别名。

Source

pub async fn login<T: LoginId>( self, login_id: Option<T>, ) -> SaTokenResult<TokenValue>

执行登录:字段在登录前注入 LoginRequest 等价路径(login_with_options)。

如果不提供 login_id 参数,则使用构建器中的 login_id。 一次性带齐可选字段,由 AuthService 阶段写入保证索引/终端/映射一致。

Trait Implementations§

Source§

impl Debug for TokenBuilder

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> ForyObject for T
where T: Any,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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