mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-08-13 07:46:51 +00:00
add creation date and expiration date to access keys
This commit is contained in:
@@ -9,6 +9,7 @@ use sha2::{Digest, Sha256};
|
||||
|
||||
use garage_table::*;
|
||||
use garage_util::data::Hash;
|
||||
use garage_util::time::now_msec;
|
||||
|
||||
use garage_model::garage::Garage;
|
||||
use garage_model::key_table::*;
|
||||
@@ -396,6 +397,13 @@ pub fn verify_v4(
|
||||
.ok_or_else(|| Error::forbidden(format!("No such key: {}", &auth.key_id)))?;
|
||||
let key_p = key.params().unwrap();
|
||||
|
||||
if key_p.is_expired(now_msec()) {
|
||||
return Err(Error::forbidden(format!(
|
||||
"Access key {} has expired",
|
||||
key.key_id
|
||||
)));
|
||||
}
|
||||
|
||||
let mut hmac = signing_hmac(
|
||||
&auth.date,
|
||||
&key_p.secret_key,
|
||||
|
||||
Reference in New Issue
Block a user