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
use crate::prelude::*;
use serde::{Deserialize, Serialize};
use std::net::IpAddr;
use time::OffsetDateTime;

#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
pub enum AuditSource {
    Internal,
    Https(IpAddr),
    Ldaps(IpAddr),
}

impl From<Source> for AuditSource {
    fn from(value: Source) -> Self {
        match value {
            Source::Internal => AuditSource::Internal,
            Source::Https(ip) => AuditSource::Https(ip),
            Source::Ldaps(ip) => AuditSource::Ldaps(ip),
        }
    }
}

#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
pub enum AuditEvent {
    AuthenticationDenied {
        source: AuditSource,
        uuid: Uuid,
        spn: String,
        #[serde(with = "time::serde::timestamp")]
        time: OffsetDateTime,
    },
}