pub struct AdminState {
pub database: Arc<Database>,
pub config: Arc<Config>,
pub profiles: Arc<HashMap<String, Arc<Profile>>>,
pub logins: Arc<LoginLimiter>,
pub templates: Arc<Environment<'static>>,
pub audit: Arc<Auditor>,
}Expand description
Shared state for every admin route.
Not crate::AppState: that one holds exactly one Profile, and this
listener is cross-profile by nature — an operator lists accounts from every
endpoint at once, and revoking an order needs that order’s own profile’s
signer, which may be a different CA from the one the request arrived
through.
Fields§
§database: Arc<Database>§config: Arc<Config>§profiles: Arc<HashMap<String, Arc<Profile>>>Keyed by profile name — the lookup orders.profile needs.
logins: Arc<LoginLimiter>§templates: Arc<Environment<'static>>The /ui templates, embedded defaults overlaid by
admin.template_dir. Built once: the loader reads a file per template
on first use, and rebuilding it per request would mean a disk read per
page.
audit: Arc<Auditor>The same process-wide auditor the ACME listener holds. Shared rather than a second instance: an operator revoking through the panel writes into the one trail, and the reverse-lookup cache is worth sharing.
Implementations§
Source§impl AdminState
impl AdminState
Sourcepub fn new(
database: Arc<Database>,
config: Arc<Config>,
profiles: &[Arc<Profile>],
audit: Arc<Auditor>,
) -> Self
pub fn new( database: Arc<Database>, config: Arc<Config>, profiles: &[Arc<Profile>], audit: Arc<Auditor>, ) -> Self
Builds the state from what serve_on already has in hand.
Takes a slice, not the Vec: build_app consumes that vec, so the
admin side has to be built first, and expressing it in the signature is
what stops the ordering being rediscovered as a borrow error.
Sourcepub fn with_logins(
database: Arc<Database>,
config: Arc<Config>,
profiles: &[Arc<Profile>],
audit: Arc<Auditor>,
previous_logins: Option<&LoginLimiter>,
) -> Self
pub fn with_logins( database: Arc<Database>, config: Arc<Config>, profiles: &[Arc<Profile>], audit: Arc<Auditor>, previous_logins: Option<&LoginLimiter>, ) -> Self
new, carrying the previous generation’s login counters.
Only a configuration reload passes Some: every other caller is building
the first generation, where there is nothing to carry. See
LoginLimiter::rebuilt for why the counters move but the limits do not.
Trait Implementations§
Source§impl Clone for AdminState
impl Clone for AdminState
Source§fn clone(&self) -> AdminState
fn clone(&self) -> AdminState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl FromRequestParts<AdminState> for PageSession
impl FromRequestParts<AdminState> for PageSession
Source§impl FromRequestParts<AdminState> for PageMfaPending
impl FromRequestParts<AdminState> for PageMfaPending
Source§impl FromRequestParts<AdminState> for PageMfaSubmit
impl FromRequestParts<AdminState> for PageMfaSubmit
Source§impl FromRequestParts<AdminState> for PageEnrolWrite
impl FromRequestParts<AdminState> for PageEnrolWrite
Source§impl FromRequestParts<AdminState> for Authenticated
impl FromRequestParts<AdminState> for Authenticated
Source§type Rejection = AdminError
type Rejection = AdminError
Source§async fn from_request_parts(
parts: &mut Parts,
state: &AdminState,
) -> Result<Self, Self::Rejection>
async fn from_request_parts( parts: &mut Parts, state: &AdminState, ) -> Result<Self, Self::Rejection>
Source§impl FromRequestParts<AdminState> for AuthenticatedWrite
impl FromRequestParts<AdminState> for AuthenticatedWrite
Source§type Rejection = AdminError
type Rejection = AdminError
Source§async fn from_request_parts(
parts: &mut Parts,
state: &AdminState,
) -> Result<Self, Self::Rejection>
async fn from_request_parts( parts: &mut Parts, state: &AdminState, ) -> Result<Self, Self::Rejection>
Source§impl FromRequestParts<AdminState> for PendingMfa
impl FromRequestParts<AdminState> for PendingMfa
Source§type Rejection = AdminError
type Rejection = AdminError
Source§async fn from_request_parts(
parts: &mut Parts,
state: &AdminState,
) -> Result<Self, Self::Rejection>
async fn from_request_parts( parts: &mut Parts, state: &AdminState, ) -> Result<Self, Self::Rejection>
Source§impl FromRequestParts<AdminState> for PendingMfaSubmit
impl FromRequestParts<AdminState> for PendingMfaSubmit
Source§type Rejection = AdminError
type Rejection = AdminError
Source§async fn from_request_parts(
parts: &mut Parts,
state: &AdminState,
) -> Result<Self, Self::Rejection>
async fn from_request_parts( parts: &mut Parts, state: &AdminState, ) -> Result<Self, Self::Rejection>
Source§impl FromRequestParts<AdminState> for EnrolWrite
impl FromRequestParts<AdminState> for EnrolWrite
Source§type Rejection = AdminError
type Rejection = AdminError
Source§async fn from_request_parts(
parts: &mut Parts,
state: &AdminState,
) -> Result<Self, Self::Rejection>
async fn from_request_parts( parts: &mut Parts, state: &AdminState, ) -> Result<Self, Self::Rejection>
Auto Trait Implementations§
impl !RefUnwindSafe for AdminState
impl !UnwindSafe for AdminState
impl Freeze for AdminState
impl Send for AdminState
impl Sync for AdminState
impl Unpin for AdminState
impl UnsafeUnpin for AdminState
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,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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