mirror of
https://forge.pointfixe.fr/hubert/gitust.git
synced 2026-02-04 10:17:28 +01:00
save
This commit is contained in:
@@ -1,6 +1,21 @@
|
||||
use actix_web_httpauth::extractors::basic::BasicAuth;
|
||||
use std::borrow::Cow;
|
||||
|
||||
pub fn check_user(name : String, pwd : String) -> bool {
|
||||
pwd.eq(&(name + "pwd")) //stub!
|
||||
pub trait AuthValidator {
|
||||
fn check_user(&self, name : &String, pwd : &String) -> bool;
|
||||
|
||||
fn check_basic(&self, basic : BasicAuth) -> bool {
|
||||
match basic.password() {
|
||||
None => {false}
|
||||
Some(pwd) => {self.check_user(&basic.user_id().to_string(), &pwd.to_string())}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TestValidator;
|
||||
|
||||
impl AuthValidator for TestValidator {
|
||||
fn check_user(&self, name: &String, pwd: &String) -> bool {
|
||||
pwd.eq(&(name.clone() + "pwd")) //stub!
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user