src/tools/ticket.rs: define const TICKET_LIFETIME

This commit is contained in:
Dietmar Maurer 2019-03-05 12:52:39 +01:00
parent 53cafb5925
commit e5662b04e9
2 changed files with 4 additions and 1 deletions

View File

@ -461,7 +461,7 @@ fn extract_auth_data(headers: &http::HeaderMap) -> (Option<String>, Option<Strin
fn check_auth(method: &hyper::Method, ticket: &Option<String>, token: &Option<String>) -> Result<String, Error> { fn check_auth(method: &hyper::Method, ticket: &Option<String>, token: &Option<String>) -> Result<String, Error> {
let ticket_lifetime = 3600*2; // 2 hours let ticket_lifetime = tools::ticket::TICKET_LIFETIME;
let username = match ticket { let username = match ticket {
Some(ticket) => match tools::ticket::verify_rsa_ticket(public_auth_key(), "PBS", &ticket, None, -300, ticket_lifetime) { Some(ticket) => match tools::ticket::verify_rsa_ticket(public_auth_key(), "PBS", &ticket, None, -300, ticket_lifetime) {

View File

@ -7,6 +7,9 @@ use openssl::pkey::{PKey, Public, Private};
use openssl::sign::{Signer, Verifier}; use openssl::sign::{Signer, Verifier};
use openssl::hash::MessageDigest; use openssl::hash::MessageDigest;
pub const TICKET_LIFETIME: i64 = 3600*2; // 2 hours
pub fn assemble_rsa_ticket( pub fn assemble_rsa_ticket(
keypair: &PKey<Private>, keypair: &PKey<Private>,
prefix: &str, prefix: &str,