]> OzVa Git service - ozva-cloud/commitdiff
feat: adjust digest auth timeout to 1day (#110)
authorsigoden <sigoden@gmail.com>
Thu, 21 Jul 2022 03:47:47 +0000 (11:47 +0800)
committerGitHub <noreply@github.com>
Thu, 21 Jul 2022 03:47:47 +0000 (11:47 +0800)
src/auth.rs

index 424d48e8d26d2c0646db07f676efecd6d7a1c4b5..37f1d6666acd4e9be8b8e496e4e001c58a2fe4c1 100644 (file)
@@ -12,6 +12,7 @@ use crate::utils::encode_uri;
 use crate::BoxResult;
 
 const REALM: &str = "DUFS";
+const DIGEST_AUTH_TIMEOUT: u32 = 86400;
 
 lazy_static! {
     static ref NONCESTARTHASH: Context = {
@@ -317,8 +318,7 @@ fn validate_nonce(nonce: &[u8]) -> Result<bool, ()> {
                 h.consume(secs_nonce.to_be_bytes());
                 let h = format!("{:x}", h.compute());
                 if h[..26] == n[8..34] {
-                    return Ok(dur < 300); // from the last 5min
-                                          //Authentication-Info ?
+                    return Ok(dur < DIGEST_AUTH_TIMEOUT);
                 }
             }
         }