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
impl Config
Sourcepub fn new<I, S>(
issuer: &str,
directory: impl Directory + 'static,
trusted_agent_providers: I,
) -> Self
pub fn new<I, S>( issuer: &str, directory: impl Directory + 'static, trusted_agent_providers: I, ) -> Self
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.
Sourcepub fn default_tenant(self, tenant: impl Into<String>) -> Self
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.
Sourcepub fn require_tenant(self) -> Self
pub fn require_tenant(self) -> Self
Refuse a request that names no tenant: for a Person Server that serves several.
Sourcepub fn trust(
self,
trusted: impl Fn(&str) -> bool + Send + Sync + 'static,
) -> Self
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.
Sourcepub fn signing_key(self, key: SigningKey) -> Self
pub fn signing_key(self, key: SigningKey) -> Self
The token-signing key. Unset, a fresh key per process.
Sourcepub fn subject_secret(self, secret: impl Into<String>) -> Self
pub fn subject_secret(self, secret: impl Into<String>) -> Self
Derives each person’s directed sub per audience. Unset, a fresh secret per process.
Sourcepub fn base_path(self, base: &str) -> Self
pub fn base_path(self, base: &str) -> Self
Where the routes live under the issuer, e.g. /ps. Default: the root.
Sourcepub fn hooks(self, hooks: impl Hooks + 'static) -> Self
pub fn hooks(self, hooks: impl Hooks + 'static) -> Self
Tell hooks about approvals, decisions and issued tokens.
Sourcepub fn admin_token(self, token: impl Into<String>) -> Self
pub fn admin_token(self, token: impl Into<String>) -> Self
Bearer token for the management routes (/consent, /missions). Unset
or empty, they are off.
Sourcepub fn description(self, description: impl Into<String>) -> Self
pub fn description(self, description: impl Into<String>) -> Self
A display description, in the metadata document.
Sourcepub fn token_ttl(self, ttl: Duration) -> Self
pub fn token_ttl(self, ttl: Duration) -> Self
How long a person or auth token lasts, at most. Default: an hour.
Sourcepub fn mission_ttl(self, ttl: Duration) -> Self
pub fn mission_ttl(self, ttl: Duration) -> Self
How long an approved mission lasts. Default: 14 days.
Sourcepub fn approval_ttl(self, ttl: Duration) -> Self
pub fn approval_ttl(self, ttl: Duration) -> Self
How long an approval waits for a decision. Default: 24 hours.
Sourcepub fn retry_after(self, after: Duration) -> Self
pub fn retry_after(self, after: Duration) -> Self
The Retry-After a pending answer carries, in whole seconds. Default:
5 seconds.