feat: apply env

This commit is contained in:
Maulana Sodiqin
2025-03-17 09:27:19 +07:00
parent 271b00c2c4
commit 0c28d34d57
14 changed files with 185 additions and 98 deletions
+9
View File
@@ -0,0 +1,9 @@
use crate::decode_access_token;
use axum::http::{header::AUTHORIZATION, HeaderMap};
pub fn extract_email(headers: &HeaderMap) -> Option<String> {
let auth_header = headers.get(AUTHORIZATION)?.to_str().ok()?;
let token = auth_header.strip_prefix("Bearer ")?;
let token_data = decode_access_token(token).ok()?;
Some(token_data.claims.sub)
}
+2
View File
@@ -1,3 +1,5 @@
pub mod extract_email;
pub mod response_format;
pub use extract_email::*;
pub use response_format::*;