save
This commit is contained in:
parent
90bc6d6d4f
commit
9af4fa56e1
|
@ -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!
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue