pub struct SaasState {
pub domain_manager: Arc<DomainManager>,
pub api_key_service: Arc<ApiKeyService>,
pub auth_layer: Arc<SaasAuthLayer>,
pub pool: PgPool,
pub cert_store: Arc<CertificateStore>,
}Expand description
Shared state for SaaS API handlers.
Fields§
§domain_manager: Arc<DomainManager>Domains, their routes and their upstreams.
api_key_service: Arc<ApiKeyService>Creating, listing and revoking API keys.
auth_layer: Arc<SaasAuthLayer>The middleware that turns a credential into an AuthContext.
pool: PgPoolThe pool, for handlers whose concern is not domain management.
wellknown serves ACME challenges out of proxy_acme_challenges, which
is a TLS concern that has no business being a method on
DomainManager. The original code carried a comment saying it needed
this and did not have it, and answered with a placeholder instead.
cert_store: Arc<CertificateStore>Where uploaded and issued certificates are kept.
Implementations§
Source§impl SaasState
impl SaasState
Sourcepub async fn new(
pool: PgPool,
jwt_secret: Option<String>,
cert_dir: impl AsRef<Path>,
) -> ProxyResult<Self>
pub async fn new( pool: PgPool, jwt_secret: Option<String>, cert_dir: impl AsRef<Path>, ) -> ProxyResult<Self>
Build the state with default SaasOptions and this JWT secret.
cert_dir is where certificates are cached on disk. A parameter rather
than a default, because a proxy that silently writes private keys to a
directory nobody chose is worse than one that makes you say where.
The defaults reserve no platform hostnames. A deployment that serves
its own names from the same proxy should use
with_options and list them in
DomainPolicy::reserved.
Sourcepub async fn with_options(
pool: PgPool,
options: SaasOptions,
cert_dir: impl AsRef<Path>,
) -> ProxyResult<Self>
pub async fn with_options( pool: PgPool, options: SaasOptions, cert_dir: impl AsRef<Path>, ) -> ProxyResult<Self>
Build the state from explicit options.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for SaasState
impl !UnwindSafe for SaasState
impl Freeze for SaasState
impl Send for SaasState
impl Sync for SaasState
impl Unpin for SaasState
impl UnsafeUnpin for SaasState
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more