pub struct Engine<S = Missing, T = Missing> {
pub providers: HashMap<String, Arc<dyn ErasedOAuthFlow>>,
pub auth_methods: HashMap<String, Arc<dyn AuthMethod>>,
pub mfa_methods: HashMap<String, Arc<dyn AuthMethod>>,
pub mfa_jwt_secret: [u8; 32],
pub session_store: S,
pub session_config: SessionConfig,
pub token_manager: T,
}Expand description
The central orchestrator for Engine.
Engine ties together authentication methods, session management, and flows.
It is constructed using the EngineBuilder which uses the Typestate pattern
to ensure that certain methods are only available when the necessary components are configured.
Fields§
§providers: HashMap<String, Arc<dyn ErasedOAuthFlow>>Map of registered OAuth providers.
auth_methods: HashMap<String, Arc<dyn AuthMethod>>Map of registered local authentication methods.
mfa_methods: HashMap<String, Arc<dyn AuthMethod>>Map of methods explicitly registered for step-up (MFA) use.
mfa_jwt_secret: [u8; 32]Internal secret for signing temporary MFA JWT tokens.
session_store: SThe session storage backend.
session_config: SessionConfigConfiguration for session cookies.
token_manager: TManager for JWT signing and verification.
Implementations§
Source§impl Engine<Missing, Missing>
impl Engine<Missing, Missing>
Sourcepub fn builder() -> EngineBuilder<Missing, Missing>
pub fn builder() -> EngineBuilder<Missing, Missing>
Start building a new Engine.
Source§impl<S, T> Engine<S, T>
impl<S, T> Engine<S, T>
Sourcepub async fn authenticate(
&self,
input: AuthInput,
) -> Result<AuthResult, AuthError>
pub async fn authenticate( &self, input: AuthInput, ) -> Result<AuthResult, AuthError>
Attempt to authenticate a user.
Returns AuthResult::Success if authentication is fully complete,
or AuthResult::MfaRequired if a second factor is needed.
Source§impl<T> Engine<Configured<Arc<dyn SessionStore>>, T>
impl<T> Engine<Configured<Arc<dyn SessionStore>>, T>
Sourcepub fn session_store(&self) -> Arc<dyn SessionStore>
pub fn session_store(&self) -> Arc<dyn SessionStore>
Get the session store.
Source§impl<S> Engine<S, Configured<Arc<TokenManager>>>
impl<S> Engine<S, Configured<Arc<TokenManager>>>
Sourcepub fn token_manager(&self) -> Arc<TokenManager>
pub fn token_manager(&self) -> Arc<TokenManager>
Get the token manager.
Trait Implementations§
Source§impl<T> HasSessionStore for Engine<Configured<Arc<dyn SessionStore>>, T>
impl<T> HasSessionStore for Engine<Configured<Arc<dyn SessionStore>>, T>
Source§fn session_store(&self) -> Arc<dyn SessionStore>
fn session_store(&self) -> Arc<dyn SessionStore>
Source§impl<S> HasTokenManager for Engine<S, Configured<Arc<TokenManager>>>
Available on crate feature token only.
impl<S> HasTokenManager for Engine<S, Configured<Arc<TokenManager>>>
token only.