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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//! Authentication and Authorization Services
//!
//! This module provides services for:
//! - **Authentication**: Validating credentials and creating contexts
//! - **Authorization**: Checking permissions based on IAM policies
//!
//! # Authentication Flow
//!
//! 1. User provides access key credentials
//! 2. `AuthenticationService` validates the credentials
//! 3. Loads the user and extracts instance/tenant from ARN
//! 4. Creates a `WamiContext` for subsequent operations
//!
//! # Authorization Flow
//!
//! 1. An authenticated `WamiContext` is provided
//! 2. `AuthorizationService` checks if action is allowed
//! 3. Root users bypass all checks (full access)
//! 4. Regular users are subject to policy evaluation
//! 5. Policies from user, groups, and roles are evaluated
//! 6. Deny overrides Allow
//!
//! # Example
//!
//! ```rust,no_run
//! use wami::{AuthenticationService, AuthorizationService, store::memory::InMemoryWamiStore, WamiArn};
//! use std::sync::Arc;
//! use tokio::sync::RwLock;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let store = Arc::new(RwLock::new(InMemoryWamiStore::default()));
//!
//! // Authenticate
//! let auth_service = AuthenticationService::new(store.clone());
//! let context = auth_service
//! .authenticate("access_key_id", "secret_access_key")
//! .await?;
//!
//! // Authorize
//! let authz_service = AuthorizationService::new(store.clone());
//! let resource: WamiArn = "arn:wami:iam:12345678:wami:999:user/alice".parse()?;
//!
//! let decision = authz_service
//! .authorize(&context, "iam:GetUser", &resource)
//! .await?;
//! println!("{decision}");
//!
//! Ok(())
//! }
//! ```
pub use ;
pub use AuthorizationService;
pub use ;
pub use ;
pub use ;