diff --git a/src/server/rest.rs b/src/server/rest.rs index b5ad9cd0..87401f4e 100644 --- a/src/server/rest.rs +++ b/src/server/rest.rs @@ -461,7 +461,7 @@ fn extract_auth_data(headers: &http::HeaderMap) -> (Option, Option, token: &Option) -> Result { - let ticket_lifetime = 3600*2; // 2 hours + let ticket_lifetime = tools::ticket::TICKET_LIFETIME; let username = match ticket { Some(ticket) => match tools::ticket::verify_rsa_ticket(public_auth_key(), "PBS", &ticket, None, -300, ticket_lifetime) { diff --git a/src/tools/ticket.rs b/src/tools/ticket.rs index 1c48a4c8..8a8ac356 100644 --- a/src/tools/ticket.rs +++ b/src/tools/ticket.rs @@ -7,6 +7,9 @@ use openssl::pkey::{PKey, Public, Private}; use openssl::sign::{Signer, Verifier}; use openssl::hash::MessageDigest; +pub const TICKET_LIFETIME: i64 = 3600*2; // 2 hours + + pub fn assemble_rsa_ticket( keypair: &PKey, prefix: &str,