You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
934 B

  1. use actix_web_httpauth::extractors::basic::BasicAuth;
  2. use crate::routes::validate_basic_auth;
  3. use crate::AppConfig;
  4. use actix_web::{dev::ServiceRequest, web, Error};
  5. // pub async fn validator(
  6. // req: ServiceRequest,
  7. // credentials: BasicAuth,
  8. // ) -> Result<ServiceRequest, Error> {
  9. // println!("{}", credentials.user_id());
  10. // println!("{:?}", credentials.password());
  11. // // verify credentials from db
  12. // let config = req.app_data::<AppConfig>().expect("Error getting config");
  13. // let valid =
  14. // web::block(move || validate_basic_auth(credentials, config)).await?;
  15. // if valid {
  16. // debug!("Success");
  17. // Ok(req)
  18. // } else {
  19. // println!("blah");
  20. // let err: Error = crate::errors::DomainError::new_password_error(
  21. // "Wrong password or account does not exist".to_string(),
  22. // )
  23. // .into();
  24. // Err(err)
  25. // }
  26. // }