From 43f443c7a85e5172b5c1a6a69db775659214196d Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Fri, 3 Jun 2022 14:00:19 +0200 Subject: WIP login --- src/login/static_provider.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/login/static_provider.rs') diff --git a/src/login/static_provider.rs b/src/login/static_provider.rs index cc6ffb6..a95ab24 100644 --- a/src/login/static_provider.rs +++ b/src/login/static_provider.rs @@ -29,12 +29,15 @@ impl StaticLoginProvider { #[async_trait] impl LoginProvider for StaticLoginProvider { async fn login(&self, username: &str, password: &str) -> Result { + tracing::debug!(user=%username, "login"); match self.users.get(username) { None => bail!("User {} does not exist", username), Some(u) => { + tracing::debug!(user=%username, "verify password"); if !verify_password(password, &u.password)? { bail!("Wrong password"); } + tracing::debug!(user=%username, "fetch bucket"); let bucket = u .bucket .clone() @@ -43,6 +46,7 @@ impl LoginProvider for StaticLoginProvider { "No bucket configured and no default bucket specieid" ))?; + tracing::debug!(user=%username, "fetch configuration"); let storage = StorageCredentials { k2v_region: self.k2v_region.clone(), s3_region: self.s3_region.clone(), @@ -51,6 +55,7 @@ impl LoginProvider for StaticLoginProvider { bucket, }; + tracing::debug!(user=%username, "fetch keys"); let keys = match (&u.master_key, &u.secret_key) { (Some(m), Some(s)) => { let master_key = Key::from_slice(&base64::decode(m)?) @@ -69,6 +74,7 @@ impl LoginProvider for StaticLoginProvider { _ => bail!("Either both master and secret key or none of them must be specified for user"), }; + tracing::debug!(user=%username, "logged"); Ok(Credentials { storage, keys }) } } -- cgit v1.2.3