From e5662b04e971c1fd3af84319d1348647c55a6239 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Tue, 5 Mar 2019 12:52:39 +0100 Subject: [PATCH] src/tools/ticket.rs: define const TICKET_LIFETIME --- src/server/rest.rs | 2 +- src/tools/ticket.rs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) 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,