2022-01-26 19:43:03 -06:00
|
|
|
// Copilot module
|
|
|
|
// Language: rust
|
2021-11-28 23:45:23 -06:00
|
|
|
|
2022-01-26 19:43:03 -06:00
|
|
|
//! 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);
|
|
|
|
//! ```
|