use axum::{
http::{HeaderMap, StatusCode, Uri},
response::Response,
};
use super::dynamo_response;
pub(super) fn validate_auth(headers: &HeaderMap, uri: &Uri, response_ct: &str) -> Option<Response> {
let material = crate::auth_material::AuthMaterial {
authorization: headers.get("authorization").and_then(|v| v.to_str().ok()),
query: uri.query().unwrap_or(""),
has_date_header: headers.get("x-amz-date").is_some() || headers.get("date").is_some(),
};
crate::auth_material::validate(material)
.map(|body| dynamo_response(StatusCode::BAD_REQUEST, response_ct, body))
}