Skip to main content

lilo_im_core/
lib.rs

1//! Identity Matters core: `Authorizer` trait, `Principal` types, peer credential
2//! extraction. Authorization is NOT enforced in v1; the v2+ roadmap replaces
3//! `lilo-im-stub` with an enforcing `lilo-im-daemon` behind the same contract.
4
5pub mod audit;
6pub mod error;
7pub mod peer_creds;
8pub mod types;
9
10use async_trait::async_trait;
11
12pub use audit::{AuditDecision, AuditRow, AuditSink};
13pub use error::{AuditError, AuthzError};
14pub use types::{Action, Authorized, Capability, Principal, ResourceSpec, RuntimeKind};
15
16pub type AuthzResult = Result<Authorized, AuthzError>;
17
18#[async_trait]
19pub trait Authorizer: Send + Sync {
20    async fn authorize(
21        &self,
22        principal: &Principal,
23        action: Action,
24        resource: &ResourceSpec,
25    ) -> AuthzResult;
26}