mirror of
https://github.com/sigoden/dufs.git
synced 2026-04-09 17:13:02 +03:00
feat: adjust digest auth timeout to 1day (#110)
This commit is contained in:
@@ -12,6 +12,7 @@ use crate::utils::encode_uri;
|
|||||||
use crate::BoxResult;
|
use crate::BoxResult;
|
||||||
|
|
||||||
const REALM: &str = "DUFS";
|
const REALM: &str = "DUFS";
|
||||||
|
const DIGEST_AUTH_TIMEOUT: u32 = 86400;
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref NONCESTARTHASH: Context = {
|
static ref NONCESTARTHASH: Context = {
|
||||||
@@ -317,8 +318,7 @@ fn validate_nonce(nonce: &[u8]) -> Result<bool, ()> {
|
|||||||
h.consume(secs_nonce.to_be_bytes());
|
h.consume(secs_nonce.to_be_bytes());
|
||||||
let h = format!("{:x}", h.compute());
|
let h = format!("{:x}", h.compute());
|
||||||
if h[..26] == n[8..34] {
|
if h[..26] == n[8..34] {
|
||||||
return Ok(dur < 300); // from the last 5min
|
return Ok(dur < DIGEST_AUTH_TIMEOUT);
|
||||||
//Authentication-Info ?
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user