pub struct AuthConfigBuilder { /* private fields */ }Expand description
A comprehensive builder for AuthConfig that organizes configuration into logical groups.
This builder provides better developer experience by grouping related settings and providing sensible defaults for each category. Use this when you need fine-grained control over the configuration but want better organization than the flat setter API.
§Example
use auth_framework::config::{AuthConfig, AuthConfigBuilder};
use std::time::Duration;
let builder = AuthConfigBuilder::new()
.tokens()
.lifetime(Duration::from_secs(3600))
.refresh_lifetime(Duration::from_secs(86400 * 7))
.issuer("myapp")
.audience("myapp-users")
.secret("my-32-char-secret-key-here!!!!!")
.done()
.security()
.min_password_length(8)
.require_complexity(true)
.secure_cookies(true)
.done()
.storage()
.memory()
.done()
.features()
.enable_multi_factor(true)
.enable_rbac(true)
.enable_caching(true)
.done();
let config = builder.build().expect("Failed to build config");Implementations§
Source§impl AuthConfigBuilder
impl AuthConfigBuilder
Sourcepub fn tokens(self) -> TokenConfigBuilder
pub fn tokens(self) -> TokenConfigBuilder
Configure token-related settings.
Sourcepub fn security(self) -> SecurityConfigBuilder
pub fn security(self) -> SecurityConfigBuilder
Configure security-related settings.
Sourcepub fn storage(self) -> StorageConfigBuilder
pub fn storage(self) -> StorageConfigBuilder
Configure storage settings.
Sourcepub fn features(self) -> FeatureConfigBuilder
pub fn features(self) -> FeatureConfigBuilder
Configure feature flags and capabilities.
Sourcepub fn rate_limiting(self) -> RateLimitConfigBuilder
pub fn rate_limiting(self) -> RateLimitConfigBuilder
Configure rate limiting.
Sourcepub fn cors(self) -> CorsConfigBuilder
pub fn cors(self) -> CorsConfigBuilder
Configure CORS settings.
Sourcepub fn audit(self) -> AuditConfigBuilder
pub fn audit(self) -> AuditConfigBuilder
Configure audit logging.
Sourcepub fn build(self) -> Result<AuthConfig>
pub fn build(self) -> Result<AuthConfig>
Build the final configuration, validating it in the process.
Trait Implementations§
Source§impl Debug for AuthConfigBuilder
impl Debug for AuthConfigBuilder
Auto Trait Implementations§
impl Freeze for AuthConfigBuilder
impl RefUnwindSafe for AuthConfigBuilder
impl Send for AuthConfigBuilder
impl Sync for AuthConfigBuilder
impl Unpin for AuthConfigBuilder
impl UnsafeUnpin for AuthConfigBuilder
impl UnwindSafe for AuthConfigBuilder
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
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>
Converts
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>
Converts
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