pub mod builder;
pub mod builtin;
pub mod executor;
pub mod registry;
pub use builder::FlowBuilder;
pub use registry::{FlowRegistration, FlowRegistry};
use std::collections::HashMap;
#[derive(Debug, Clone)]
pub enum AuthStep {
Login {
credential_type: String,
},
Mfa {
credential_type: Option<String>,
},
SocialProvider {
provider: String,
},
SsoServer {
server_id: String,
},
RequiredAction {
action: String,
},
Conditional {
condition: AuthCondition,
if_step: Box<AuthStep>,
else_step: Option<Box<AuthStep>>,
},
SubFlow {
flow_name: String,
},
}
#[derive(Debug, Clone)]
pub enum AuthCondition {
HasCredential(String),
IsLocked,
IpWhitelisted,
Custom(String),
}
#[derive(Debug, Clone)]
pub struct AuthenticationFlow {
pub name: String,
pub steps: Vec<AuthStep>,
pub allow_skip: bool,
}
#[derive(Debug, Clone)]
pub struct AuthContext {
pub input: String,
pub user_id: Option<String>,
pub tenant_id: Option<String>,
pub ip: String,
pub completed_steps: Vec<usize>,
pub extras: HashMap<String, String>,
}
#[derive(Debug, Clone)]
pub enum AuthResult {
Success {
login_id: String,
token: String,
},
Failed {
reason: String,
step: usize,
},
Pending {
completed_step: usize,
next_step: usize,
challenge: String,
},
ChallengeRequired {
challenge_type: String,
message: String,
},
}
#[cfg(test)]
mod tests;