pub struct BetterAuth<S: AuthSchema> { /* private fields */ }Implementations§
Source§impl<S: AuthSchema> BetterAuth<S>
impl<S: AuthSchema> BetterAuth<S>
Sourcepub fn new(config: AuthConfig) -> AuthBuilder<S>
pub fn new(config: AuthConfig) -> AuthBuilder<S>
Create a new BetterAuth builder.
Source§impl<S: AuthSchema> BetterAuth<S>
impl<S: AuthSchema> BetterAuth<S>
Sourcepub async fn handle_request(&self, req: AuthRequest) -> AuthResult<AuthResponse>
pub async fn handle_request(&self, req: AuthRequest) -> AuthResult<AuthResponse>
Handle an authentication request.
Errors from plugins and core handlers are automatically converted
into standardized JSON responses via AuthError::to_auth_response,
producing { "message": "..." } with the appropriate HTTP status code.
Sourcepub fn config(&self) -> &AuthConfig
pub fn config(&self) -> &AuthConfig
Get the configuration.
Sourcepub fn body_limit(&self) -> &BodyLimitConfig
pub fn body_limit(&self) -> &BodyLimitConfig
Get the effective request body size limit.
Transports read the body before any middleware runs, so they need this to bound the read itself rather than rejecting after buffering.
Sourcepub fn session_manager(&self) -> &SessionManager<S>
pub fn session_manager(&self) -> &SessionManager<S>
Get the session manager.
Sourcepub fn routes(&self) -> Vec<(String, &dyn AuthPlugin<S>)>
pub fn routes(&self) -> Vec<(String, &dyn AuthPlugin<S>)>
Get all routes from plugins.
Sourcepub fn plugins(&self) -> &[Box<dyn AuthPlugin<S>>]
pub fn plugins(&self) -> &[Box<dyn AuthPlugin<S>>]
Get all plugins.
Sourcepub fn get_plugin(&self, name: &str) -> Option<&dyn AuthPlugin<S>>
pub fn get_plugin(&self, name: &str) -> Option<&dyn AuthPlugin<S>>
Get plugin by name.
Sourcepub fn plugin_names(&self) -> Vec<&'static str>
pub fn plugin_names(&self) -> Vec<&'static str>
List all plugin names.
Sourcepub fn openapi_spec(&self) -> OpenApiSpec
pub fn openapi_spec(&self) -> OpenApiSpec
Generate the OpenAPI spec for all registered routes.
Auto Trait Implementations§
impl<S> !RefUnwindSafe for BetterAuth<S>
impl<S> !UnwindSafe for BetterAuth<S>
impl<S> Freeze for BetterAuth<S>
impl<S> Send for BetterAuth<S>
impl<S> Sync for BetterAuth<S>
impl<S> Unpin for BetterAuth<S>
impl<S> UnsafeUnpin for BetterAuth<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