pub struct QuickStartBuilder { /* private fields */ }Expand description
Quick start builder for common authentication setups.
Provides the fastest path to a working AuthFramework by combining
authentication method, storage, and framework integrations in a single
fluent chain. Start via AuthFramework::quick_start().
§Example
use auth_framework::prelude::*;
let auth = AuthFramework::quick_start()
.jwt_auth("my-secret-key-that-is-long-enough!!")
.build().await?;Implementations§
Source§impl QuickStartBuilder
impl QuickStartBuilder
Sourcepub fn jwt_auth(self, secret: impl Into<String>) -> Self
pub fn jwt_auth(self, secret: impl Into<String>) -> Self
Configure JWT authentication with a secret key.
§Example
use auth_framework::prelude::*;
let auth = AuthFramework::quick_start()
.jwt_auth("my-long-secret-key-32-chars-min!!")
.build().await?;Sourcepub fn jwt_auth_from_env(self) -> Self
pub fn jwt_auth_from_env(self) -> Self
Configure JWT authentication from JWT_SECRET environment variable.
§Example
use auth_framework::prelude::*;
// Reads JWT_SECRET from the environment
let auth = AuthFramework::quick_start()
.jwt_auth_from_env()
.build().await?;Sourcepub fn oauth2_auth(
self,
client_id: impl Into<String>,
client_secret: impl Into<String>,
) -> Self
pub fn oauth2_auth( self, client_id: impl Into<String>, client_secret: impl Into<String>, ) -> Self
Configure OAuth2 authentication.
§Example
use auth_framework::prelude::*;
let auth = AuthFramework::quick_start()
.oauth2_auth("client-id", "client-secret")
.build().await?;Sourcepub fn combined_auth(
self,
jwt_secret: impl Into<String>,
oauth_client_id: impl Into<String>,
oauth_client_secret: impl Into<String>,
) -> Self
pub fn combined_auth( self, jwt_secret: impl Into<String>, oauth_client_id: impl Into<String>, oauth_client_secret: impl Into<String>, ) -> Self
Configure both JWT and OAuth2 authentication.
§Example
use auth_framework::prelude::*;
let auth = AuthFramework::quick_start()
.combined_auth("jwt-secret-long-enough-32chars!!", "client-id", "secret")
.build().await?;Sourcepub fn with_postgres(self, connection_string: impl Into<String>) -> Self
pub fn with_postgres(self, connection_string: impl Into<String>) -> Self
Use PostgreSQL storage with connection string.
§Example
use auth_framework::prelude::*;
let auth = AuthFramework::quick_start()
.jwt_auth("my-long-secret-key-32-chars-min!!")
.with_postgres("postgresql://user:pass@localhost/auth")
.build().await?;Sourcepub fn with_postgres_from_env(self) -> Self
pub fn with_postgres_from_env(self) -> Self
Use PostgreSQL storage from DATABASE_URL environment variable.
§Example
use auth_framework::prelude::*;
let auth = AuthFramework::quick_start()
.jwt_auth("my-long-secret-key-32-chars-min!!")
.with_postgres_from_env()
.build().await?;Sourcepub fn with_redis(self, connection_string: impl Into<String>) -> Self
pub fn with_redis(self, connection_string: impl Into<String>) -> Self
Use Redis storage with connection string.
§Example
use auth_framework::prelude::*;
let auth = AuthFramework::quick_start()
.jwt_auth("my-long-secret-key-32-chars-min!!")
.with_redis("redis://localhost:6379")
.build().await?;Sourcepub fn with_redis_from_env(self) -> Self
pub fn with_redis_from_env(self) -> Self
Use Redis storage from REDIS_URL environment variable.
§Example
use auth_framework::prelude::*;
let auth = AuthFramework::quick_start()
.jwt_auth("my-long-secret-key-32-chars-min!!")
.with_redis_from_env()
.build().await?;Sourcepub fn with_memory_storage(self) -> Self
pub fn with_memory_storage(self) -> Self
Use in-memory storage (development only).
§Example
use auth_framework::prelude::*;
let auth = AuthFramework::quick_start()
.jwt_auth("my-long-secret-key-32-chars-min!!")
.with_memory_storage()
.build().await?;Sourcepub fn with_axum(self) -> Self
pub fn with_axum(self) -> Self
Configure for Axum web framework.
§Example
use auth_framework::prelude::*;
let auth = AuthFramework::quick_start()
.jwt_auth("my-long-secret-key-32-chars-min!!")
.with_axum()
.build().await?;Sourcepub fn with_actix(self) -> Self
pub fn with_actix(self) -> Self
Configure for Actix Web framework.
§Example
use auth_framework::prelude::*;
let auth = AuthFramework::quick_start()
.jwt_auth("my-long-secret-key-32-chars-min!!")
.with_actix()
.build().await?;Sourcepub fn with_warp(self) -> Self
pub fn with_warp(self) -> Self
Configure for Warp web framework.
§Example
use auth_framework::prelude::*;
let auth = AuthFramework::quick_start()
.jwt_auth("my-long-secret-key-32-chars-min!!")
.with_warp()
.build().await?;Sourcepub fn security_level(self, level: SecurityPreset) -> Self
pub fn security_level(self, level: SecurityPreset) -> Self
Set security level.
§Example
use auth_framework::prelude::*;
let auth = AuthFramework::quick_start()
.jwt_auth("my-long-secret-key-32-chars-min!!")
.security_level(SecurityPreset::HighSecurity)
.build().await?;Sourcepub async fn build(self) -> Result<AuthFramework, AuthError>
pub async fn build(self) -> Result<AuthFramework, AuthError>
Build the authentication framework.
Applies the configured auth method, storage, and security level,
then delegates to AuthBuilder::build.
§Example
use auth_framework::prelude::*;
let auth = AuthFramework::quick_start()
.jwt_auth("my-long-secret-key-32-chars-min!!")
.build().await?;Trait Implementations§
Auto Trait Implementations§
impl Freeze for QuickStartBuilder
impl RefUnwindSafe for QuickStartBuilder
impl Send for QuickStartBuilder
impl Sync for QuickStartBuilder
impl Unpin for QuickStartBuilder
impl UnsafeUnpin for QuickStartBuilder
impl UnwindSafe for QuickStartBuilder
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> 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