pub struct AccessProviders { /* private fields */ }Expand description
User identity providers used to authenticate and authorize Universal Exports requests.
Implementations§
Source§impl AccessProviders
impl AccessProviders
Sourcepub fn provider_ids(&self) -> Vec<String>
pub fn provider_ids(&self) -> Vec<String>
The IDs a sign-in policy may list: each named sign-in provider and the page
authenticator. The built-in proxy identity has none, so a providers condition never
matches its step.
Source§impl AccessProviders
impl AccessProviders
Sourcepub fn new(
authenticator: Arc<dyn Authenticator>,
directory: Arc<dyn Directory>,
authorizer: Arc<dyn Authorizer>,
) -> Self
pub fn new( authenticator: Arc<dyn Authenticator>, directory: Arc<dyn Directory>, authorizer: Arc<dyn Authorizer>, ) -> Self
Combines the configured authentication, identity and authorization providers.
Sourcepub fn with_authenticator(self, authenticator: Arc<dyn Authenticator>) -> Self
pub fn with_authenticator(self, authenticator: Arc<dyn Authenticator>) -> Self
Adds a sign-in provider for people, asked after those already added: a name and a
password go to each in turn until one claims them. The directory stays the one given to
new.
Sourcepub fn named(self, id: impl Into<String>) -> Self
pub fn named(self, id: impl Into<String>) -> Self
Names the sign-in provider added last by id, the ID a sign-in policy lists it by.
A provider with no name is asked only when a policy lists none.
Sourcepub fn with_second_factor(
self,
id: impl Into<String>,
authenticator: Arc<dyn Authenticator>,
accounts: Option<Arc<dyn Accounts>>,
) -> Self
pub fn with_second_factor( self, id: impl Into<String>, authenticator: Arc<dyn Authenticator>, accounts: Option<Arc<dyn Accounts>>, ) -> Self
Adds a provider that checks a one-time code once an earlier step named the person, listed
in a sign-in policy by id. It is never asked for a first factor. With accounts, people
set up and reset their factor through it.
Sourcepub fn with_factor_sealer(self, sealer: Arc<FactorSealer>) -> Self
pub fn with_factor_sealer(self, sealer: Arc<FactorSealer>) -> Self
The key one-time code secrets are sealed with. Without a ready one setting up a factor is refused.
Sourcepub fn with_sign_in(self, sign_in: Arc<LiveSignIn>) -> Self
pub fn with_sign_in(self, sign_in: Arc<LiveSignIn>) -> Self
Lets sign_in decide which methods a sign-in may use. Without it each configured method
alone is enough, from anywhere. Bearer keys are outside it.
Sourcepub fn with_sign_in_policy(self, policy: Arc<dyn SignInPolicy>) -> Self
pub fn with_sign_in_policy(self, policy: Arc<dyn SignInPolicy>) -> Self
Lets policy decide which methods a sign-in may use, as it stands; no route changes it.
Sourcepub fn with_keys(self, keys: KeyProvider) -> Self
pub fn with_keys(self, keys: KeyProvider) -> Self
Takes bearer keys from keys. A key is presented as the bearer of a request, never as a
password: the sign-in routes do not ask this provider.
Sourcepub fn keys_only(
directory: Arc<dyn Directory>,
authorizer: Arc<dyn Authorizer>,
) -> Self
pub fn keys_only( directory: Arc<dyn Directory>, authorizer: Arc<dyn Authorizer>, ) -> Self
Access for bearer keys alone: nobody signs in with a password. Add the key provider with
with_keys.
Sourcepub fn from_reverse_proxy(
directory: Arc<dyn Directory>,
authorizer: Arc<dyn Authorizer>,
header: HeaderName,
lookup_by: impl Into<String>,
) -> Self
pub fn from_reverse_proxy( directory: Arc<dyn Directory>, authorizer: Arc<dyn Authorizer>, header: HeaderName, lookup_by: impl Into<String>, ) -> Self
Uses a sanitized identity header supplied by the trusted reverse proxy.
The proxy must remove any client-provided value for this header and set
it only after authenticating the request. lookup_by selects the
Directory attribute used to resolve that identity (commonly name or
email).
Sourcepub fn with_page_authenticator(
self,
authenticator: Arc<dyn Authenticator>,
) -> Self
pub fn with_page_authenticator( self, authenticator: Arc<dyn Authenticator>, ) -> Self
Names the person asking for one of Moneypenny’s pages by authenticator, a provider that
reads the request itself (coqui_access_mtls, coqui_access_proxy): it is given the
request’s headers but cookies, its client’s address, and the certificates the client
proved on Gateway::serve_tls. Only the page routes ask it; no /v1 route does.
Sourcepub fn with_page_authenticator_id(self, id: impl Into<String>) -> Self
pub fn with_page_authenticator_id(self, id: impl Into<String>) -> Self
Names the page authenticator by id, the ID a sign-in policy lists it by.
Sourcepub fn with_proxy_identity(
self,
header: HeaderName,
lookup_by: impl Into<String>,
) -> Self
pub fn with_proxy_identity( self, header: HeaderName, lookup_by: impl Into<String>, ) -> Self
Adds trusted reverse-proxy identity as a login method alongside password login.
Sourcepub fn with_proxy_secret(
self,
secret: impl Into<String>,
min_bytes: usize,
) -> Result<Self, String>
pub fn with_proxy_secret( self, secret: impl Into<String>, min_bytes: usize, ) -> Result<Self, String>
The secret the reverse proxy sends in PROXY_SECRET_HEADER with every request; an
asserted identity is accepted only beside it, so a client that reaches the gateway’s port
without the proxy (a local process among them) cannot assert one. Without a secret no
asserted identity is accepted.
§Errors
A message when secret is shorter than min_bytes or there is no proxy
identity to guard.