@@ -48,7 +48,6 @@ impl Ping { | |||||
false | false | ||||
} else { | } else { | ||||
let hash = hash_token_with_salt(auth_token, self.time, &self.salt); | let hash = hash_token_with_salt(auth_token, self.time, &self.salt); | ||||
eprintln!("Ping.verify: INFO: comparing provided hash={} with calculated hash={}", self.hash, hash); | |||||
self.hash.eq(&hash) | self.hash.eq(&hash) | ||||
} | } | ||||
} | } | ||||
@@ -63,7 +62,5 @@ fn hash_token_with_salt(auth_token: Arc<String>, time : u128, salt: &String) -> | |||||
hasher.update(b":"); | hasher.update(b":"); | ||||
hasher.update(auth_token.to_string()); | hasher.update(auth_token.to_string()); | ||||
let digest = hasher.finalize(); | let digest = hasher.finalize(); | ||||
let hash = hex::encode(digest); | |||||
eprintln!("hash_token_with_salt: INFO: salt={} and token={} created hash={}", salt, auth_token.to_string(), hash); | |||||
hash | |||||
hex::encode(digest) | |||||
} | } |
@@ -97,7 +97,7 @@ async fn proxy(client: Client<HttpsConnector<HttpConnector<CacheResolver>>>, | |||||
let body_bytes = hyper::body::to_bytes(req.into_body()).await?; | let body_bytes = hyper::body::to_bytes(req.into_body()).await?; | ||||
let body = String::from_utf8(body_bytes.to_vec()).unwrap(); | let body = String::from_utf8(body_bytes.to_vec()).unwrap(); | ||||
let ping : Ping = serde_json::from_str(body.as_str()).unwrap(); | let ping : Ping = serde_json::from_str(body.as_str()).unwrap(); | ||||
eprintln!("proxy: INFO: received body: {:?}", ping); | |||||
eprintln!("proxy: DEBUG: received body: {:?}", ping); | |||||
if !ping.verify(auth_token.clone()) { | if !ping.verify(auth_token.clone()) { | ||||
eprintln!("proxy: ERROR: invalid ping hash"); | eprintln!("proxy: ERROR: invalid ping hash"); | ||||
bad_request("invalid ping hash") | bad_request("invalid ping hash") | ||||