Skip to main content

Config

Struct Config 

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

How a Person Server is set up. issuer, the directory and the trusted agent providers are required; everything else has a default.

Implementations§

Source§

impl Config

Source

pub fn new<I, S>( issuer: &str, directory: impl Directory + 'static, trusted_agent_providers: I, ) -> Self
where I: IntoIterator<Item = S>, S: AsRef<str>,

issuer is https://host, with no port or path. Agents may ask only when their agent token’s iss is one of trusted_agent_providers.

Source

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

The tenant a request that names none is under. Default: DEFAULT_TENANT. A company’s own Person Server names its own.

Source

pub fn require_tenant(self) -> Self

Refuse a request that names no tenant: for a Person Server that serves several.

Source

pub fn trust( self, trusted: impl Fn(&str) -> bool + Send + Sync + 'static, ) -> Self

Decide trust in an agent provider by its iss instead of a list.

Source

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

The token-signing key. Unset, a fresh key per process.

Source

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

Derives each person’s directed sub per audience. Unset, a fresh secret per process.

Source

pub fn store(self, store: Arc<dyn Store>) -> Self

Where state is kept; in memory by default.

Source

pub fn base_path(self, base: &str) -> Self

Where the routes live under the issuer, e.g. /ps. Default: the root.

Source

pub fn hooks(self, hooks: impl Hooks + 'static) -> Self

Tell hooks about approvals, decisions and issued tokens.

Source

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

Bearer token for the management routes (/consent, /missions). Unset or empty, they are off.

Source

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

A display name, in the metadata document.

Source

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

A display description, in the metadata document.

Source

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

How long a person or auth token lasts, at most. Default: an hour.

Source

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

How long an approved mission lasts. Default: 14 days.

Source

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

How long an approval waits for a decision. Default: 24 hours.

Source

pub fn retry_after(self, after: Duration) -> Self

The Retry-After a pending answer carries, in whole seconds. Default: 5 seconds.

Source

pub fn fetch(self, fetch: Arc<dyn Fetch>) -> Self

How agent provider, resource and R3 documents are fetched. Unset, a guarded reqwest client (with the reqwest feature).

Source

pub fn clock(self, now: impl Fn() -> i64 + Send + Sync + 'static) -> Self

Seconds since the epoch; for tests.

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

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