MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / test_auth

Function test_auth

nodedb/src/control/security/conditional.rs:263–287  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

261 use std::collections::HashMap;
262
263 fn test_auth() -> AuthContext {
264 AuthContext {
265 id: "42".into(),
266 username: "alice".into(),
267 email: None,
268 tenant_id: crate::types::TenantId::new(1),
269 org_id: None,
270 org_ids: Vec::new(),
271 roles: vec!["readwrite".into()],
272 groups: Vec::new(),
273 permissions: Vec::new(),
274 status: super::super::auth_context::AuthStatus::Active,
275 metadata: HashMap::new(),
276 auth_method: super::super::identity::AuthMethod::ApiKey,
277 auth_time: Some(
278 std::time::SystemTime::now()
279 .duration_since(std::time::UNIX_EPOCH)
280 .unwrap()
281 .as_secs(),
282 ),
283 session_id: "test".into(),
284 on_deny_override: None,
285 database_id: None,
286 }
287 }
288
289 #[test]
290 fn mfa_required_passes() {

Callers 5

mfa_required_passesFunction · 0.85
mfa_required_failsFunction · 0.85
ip_requirementFunction · 0.85
step_up_authFunction · 0.85
device_trustFunction · 0.85

Calls 2

nowFunction · 0.85
duration_sinceMethod · 0.80

Tested by

no test coverage detected