pub struct AuthBuilder<S: AuthSchema> { /* private fields */ }Expand description
Initial builder for configuring BetterAuth.
Implementations§
Source§impl<S: AuthSchema> AuthBuilder<S>
impl<S: AuthSchema> AuthBuilder<S>
pub fn new(config: AuthConfig) -> Self
Sourcepub fn store<T>(self, store: T) -> Selfwhere
T: AuthStore<S> + 'static,
pub fn store<T>(self, store: T) -> Selfwhere
T: AuthStore<S> + 'static,
Set the shared auth store implementation.
Sourcepub fn store_arc(self, store: Arc<dyn AuthStore<S>>) -> Self
pub fn store_arc(self, store: Arc<dyn AuthStore<S>>) -> Self
Set the shared auth store implementation using an existing Arc.
Sourcepub fn plugin<P: AuthPlugin<S> + 'static>(self, plugin: P) -> Self
pub fn plugin<P: AuthPlugin<S> + 'static>(self, plugin: P) -> Self
Add a plugin to the authentication system.
Sourcepub fn csrf(self, config: CsrfConfig) -> Self
pub fn csrf(self, config: CsrfConfig) -> Self
Configure CSRF protection.
Sourcepub fn rate_limit(self, config: RateLimitConfig) -> Self
pub fn rate_limit(self, config: RateLimitConfig) -> Self
Configure rate limiting.
Sourcepub fn cors(self, config: CorsConfig) -> Self
pub fn cors(self, config: CorsConfig) -> Self
Configure CORS.
Sourcepub fn body_limit(self, config: BodyLimitConfig) -> Self
pub fn body_limit(self, config: BodyLimitConfig) -> Self
Configure body size limit.
Sourcepub fn email_provider<E: EmailProvider + 'static>(self, provider: E) -> Self
pub fn email_provider<E: EmailProvider + 'static>(self, provider: E) -> Self
Set the email provider.
Sourcepub fn middleware<M: Middleware + 'static>(self, mw: M) -> Self
pub fn middleware<M: Middleware + 'static>(self, mw: M) -> Self
Add a custom middleware.
Sourcepub async fn build(self) -> AuthResult<BetterAuth<S>>
pub async fn build(self) -> AuthResult<BetterAuth<S>>
Build the BetterAuth instance.
Auto Trait Implementations§
impl<S> !RefUnwindSafe for AuthBuilder<S>
impl<S> !UnwindSafe for AuthBuilder<S>
impl<S> Freeze for AuthBuilder<S>
impl<S> Send for AuthBuilder<S>
impl<S> Sync for AuthBuilder<S>
impl<S> Unpin for AuthBuilder<S>
impl<S> UnsafeUnpin for AuthBuilder<S>
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
Mutably borrows from an owned value. Read more