Skip to main content

DeviceAuthBuilder

Struct DeviceAuthBuilder 

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

Builds a DeviceAuth. Everything the module cannot decide for a venture — who its clients are, who may approve, what a credential looks like, where entropy comes from — is set here.

Implementations§

Source§

impl DeviceAuthBuilder

Source

pub fn new() -> Self

The RFC 8628 defaults: a ten-minute code, a five-second poll interval and a five-wrong-entry allowance.

Source

pub fn client(self, client: DeviceClient) -> Self

Adds one client. Repeatable.

Source

pub fn clients(self, clients: impl IntoIterator<Item = DeviceClient>) -> Self

Declares the whole client list. Replaces any previous one.

Source

pub fn approver(self, approver: impl Approver + 'static) -> Self

Sets the approver hook. Without one, the module uses CallerApprover over the Auth port when a deployment mounts one.

Source

pub fn issuer(self, issuer: impl Issuer + 'static) -> Self

Sets the issuer hook.

Source

pub fn random(self, random: impl RandomBytes + 'static) -> Self

Sets the entropy source the two codes are drawn from. Required: core carries no CSPRNG, so the venture supplies one (ADR 0002).

Source

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

Where the stock CallerApprover sends an anonymous browser. Defaults to /login.

Source

pub fn expires_in(self, ttl: Duration) -> Self

How long a device code stays usable. Clamped to at least one second, and at most MAX_EXPIRES_IN.

Source

pub fn interval(self, interval: Duration) -> Self

The poll interval a client is told to use, and the shortest gap a poll may arrive at. Clamped to at least one second.

Source

pub fn max_wrong_entries(self, allowance: u32) -> Self

The wrong-entry allowance per approver before the limiter refuses. Clamped to at least one.

Source

pub fn build(self) -> DeviceAuth

Builds the module.

Trait Implementations§

Source§

impl Default for DeviceAuthBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. 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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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