Struct TokenSignerBuilder

Source
pub struct TokenSignerBuilder<Claims, Algo>
where Algo: Algorithm,
{ /* private fields */ }
Expand description

Builder for TokenSigner.

Implementations§

Source§

impl<Claims, Algo> TokenSignerBuilder<Claims, Algo>
where Algo: Algorithm,

Source

pub fn access_token_name<VALUE: Into<String>>(self, value: VALUE) -> Self

The name of the future access tokens.

For example, the name of the cookie generated in TokenSigner::create_access_cookie.

Defaults to "access_token"

Source

pub fn access_token_lifetime(self, value: Duration) -> Self

The lifetime duration of the access token.

Defaults to Duration::from_secs(60)

Source

pub fn refresh_token_name<VALUE: Into<String>>(self, value: VALUE) -> Self

The name of the future refresh tokens.

For example, the name of the cookie generated in TokenSigner::create_refresh_cookie.

Defaults to "refresh_token"

Source

pub fn refresh_token_lifetime(self, value: Duration) -> Self

The lifetime duration of the refresh token.

Defaults to Duration::from_secs(30 * 60)

Source

pub fn header(self, value: Header) -> Self

JWT Header used in the creation of access and refresh tokens.

Please refer to the structs own documentation for more details.

Defaults to Header::default()

Source

pub fn algorithm(self, value: Algo) -> Self

The Cryptographic signing algorithm used in the process of creation of access and refresh tokens.

Please referee to the Supported algorithms section of the jwt-compact crate for a comprehensive list of the supported algorithms.

Source

pub fn signing_key(self, value: Algo::SigningKey) -> Self

Key used to sign tokens.

Source

pub fn time_options(self, value: TimeOptions) -> Self

Used in the creating of the token, the current time stamp is taken from this.

Please refer to the structs own documentation for more details.

Defaults to TimeOptions::from_leeway(Duration::seconds(0))

Source

pub fn build(self) -> Result<TokenSigner<Claims, Algo>, TokenSignerBuilderError>

Builds a new TokenSigner.

§Errors

If a required field has not been initialized.

Trait Implementations§

Source§

impl<Claims, Algo> Default for TokenSignerBuilder<Claims, Algo>
where Algo: Algorithm,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<Claims, Algo> Freeze for TokenSignerBuilder<Claims, Algo>
where Algo: Freeze, <Algo as Algorithm>::SigningKey: Freeze,

§

impl<Claims, Algo> RefUnwindSafe for TokenSignerBuilder<Claims, Algo>
where Algo: RefUnwindSafe, <Algo as Algorithm>::SigningKey: RefUnwindSafe, Claims: RefUnwindSafe,

§

impl<Claims, Algo> Send for TokenSignerBuilder<Claims, Algo>
where Algo: Send, <Algo as Algorithm>::SigningKey: Send, Claims: Send,

§

impl<Claims, Algo> Sync for TokenSignerBuilder<Claims, Algo>
where Algo: Sync, <Algo as Algorithm>::SigningKey: Sync, Claims: Sync,

§

impl<Claims, Algo> Unpin for TokenSignerBuilder<Claims, Algo>
where Algo: Unpin, <Algo as Algorithm>::SigningKey: Unpin, Claims: Unpin,

§

impl<Claims, Algo> UnwindSafe for TokenSignerBuilder<Claims, Algo>
where Algo: UnwindSafe, <Algo as Algorithm>::SigningKey: UnwindSafe, Claims: UnwindSafe,

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

impl<T> ErasedDestructor for T
where T: 'static,