auth_service_gleven 0.1.0

auth service example
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use rand::prelude::*;

mod auth_utils;
mod database;

// 使用 use 关键字
pub use auth_utils::models::Credentials;
use database::Status;

// 公用API,提供认证服务
pub fn authenticate(creds: Credentials) {
    let timeout = thread_rng().gen_range(100..=500);
    println!("timeout is {timeout}");
    if let Status::Connected = database::connect_to_database() {
        auth_utils::login(creds);
    }
}