forked from AbleOS/ableos
24 lines
779 B
Rust
24 lines
779 B
Rust
// Copilot module
|
|
// Language: rust
|
|
|
|
//! Security module.
|
|
//!
|
|
//! This module provides a security interface for AbleOS.
|
|
//!
|
|
//! # Examples
|
|
//! ```
|
|
//! use crate::security::Security;
|
|
//!
|
|
//! let mut security = Security::new();
|
|
//! security.add_user("admin", "password");
|
|
//! security.add_user("user", "password");
|
|
//! security.add_user("guest", "password");
|
|
//!
|
|
//! assert_eq!(security.authenticate("admin", "password"), true);
|
|
//! assert_eq!(security.authenticate("user", "password"), true);
|
|
//! assert_eq!(security.authenticate("guest", "password"), true);
|
|
//! assert_eq!(security.authenticate("admin", "password2"), false);
|
|
//! assert_eq!(security.authenticate("user", "password2"), false);
|
|
//! assert_eq!(security.authenticate("guest", "password2"), false);
|
|
//! ```
|