1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//! The Identity Management components that are layered ontop of the [QueryServer](crate::server::QueryServer). These allow
//! rich and expressive events and transformations that are lowered into the correct/relevant
//! actions in the [QueryServer](crate::server::QueryServer). Generally this is where "Identity Management" policy and code
//! is implemented.

pub mod account;
pub mod authsession;
pub mod credupdatesession;
pub mod delayed;
pub mod event;
pub mod group;
pub mod oauth2;
pub mod radius;
pub mod scim;
pub mod server;
pub mod serviceaccount;
pub mod unix;

use std::fmt;

use kanidm_proto::v1::{AuthAllowed, AuthIssueSession, AuthMech};

pub enum AuthState {
    Choose(Vec<AuthMech>),
    Continue(Vec<AuthAllowed>),
    Denied(String),
    Success(String, AuthIssueSession),
}

impl fmt::Debug for AuthState {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            AuthState::Choose(mechs) => write!(f, "AuthState::Choose({:?})", mechs),
            AuthState::Continue(allow) => write!(f, "AuthState::Continue({:?})", allow),
            AuthState::Denied(reason) => write!(f, "AuthState::Denied({:?})", reason),
            AuthState::Success(_token, issue) => write!(f, "AuthState::Success({:?})", issue),
        }
    }
}