pub struct Builder<D, U, P, S, B> { /* private fields */ }Expand description
Collects configuration. .build() only exists once secret, base_url and database
are set: the last three type parameters track that.
Implementations§
Source§impl<D, U, P, S, B> Builder<D, U, P, S, B>
impl<D, U, P, S, B> Builder<D, U, P, S, B>
Sourcepub fn secret(self, secret: Secret) -> Builder<D, U, P, Present, B>
pub fn secret(self, secret: Secret) -> Builder<D, U, P, Present, B>
The master secret (at least 32 bytes). See Secret::from_env.
Sourcepub fn secrets(
self,
secrets: impl IntoIterator<Item = Secret>,
) -> Builder<D, U, P, Present, B>
pub fn secrets( self, secrets: impl IntoIterator<Item = Secret>, ) -> Builder<D, U, P, Present, B>
Several secrets for rotation: the first signs, all verify.
Sourcepub fn base_url(self, url: impl Into<String>) -> Builder<D, U, P, S, Present>
pub fn base_url(self, url: impl Into<String>) -> Builder<D, U, P, S, Present>
The public URL of the app, e.g. https://acme.dk.
pub fn app_name(self, name: impl Into<String>) -> Self
Sourcepub fn base_path(self, path: impl Into<String>) -> Self
pub fn base_path(self, path: impl Into<String>) -> Self
Where auth routes live (default /api/auth).
Sourcepub fn trusted_origins(
self,
origins: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn trusted_origins( self, origins: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Origins allowed to make cookie-carrying requests and to be redirect targets.
pub fn email_password(self, config: EmailPassword) -> Self
pub fn email_verification(self, config: EmailVerification) -> Self
pub fn session(self, config: SessionConfig) -> Self
pub fn rate_limit(self, config: RateLimit) -> Self
pub fn client_ip(self, source: ClientIp) -> Self
Sourcepub fn ids(self, strategy: IdStrategy) -> Self
pub fn ids(self, strategy: IdStrategy) -> Self
How ids are generated and stored; IdStrategy::Ulid unless set.
Apps upgrading a Postgres database created by fastauth 0.1 (uuid id columns)
keep it working with .ids(IdStrategy::UuidV7).
pub fn mailer(self, mailer: impl Mailer) -> Self
Sourcepub fn allow_insecure_config(self, allow: bool) -> Self
pub fn allow_insecure_config(self, allow: bool) -> Self
Builds a configuration that .build() refuses for production, logging each problem
as a warning instead: an http:// base_url on a host other than localhost, or a
secret with too little entropy. For local development, CI and staging setups on a
private network only. A localhost base_url gets the same leniency without it.
Sourcepub fn user_fields<U2: Fields>(self) -> Builder<D, U2, P, S, B>
pub fn user_fields<U2: Fields>(self) -> Builder<D, U2, P, S, B>
The app’s own columns on user.