+8
-15
@@ -1,25 +1,18 @@
|
||||
use axum::{
|
||||
extract::Request,
|
||||
http::{StatusCode},
|
||||
middleware::Next,
|
||||
response::Response,
|
||||
use axum::{extract::Request, http::StatusCode, middleware::Next, response::Response};
|
||||
|
||||
use crate::auth::{
|
||||
jwt::validate_token,
|
||||
keycloak::{get_jwks, refresh_jwks},
|
||||
};
|
||||
|
||||
use crate::auth::{jwt::validate_token, keycloak::{get_jwks, refresh_jwks}};
|
||||
|
||||
pub async fn auth_middleware(
|
||||
mut request: Request,
|
||||
next: Next,
|
||||
) -> Result<Response, StatusCode> {
|
||||
pub async fn auth_middleware(mut request: Request, next: Next) -> Result<Response, StatusCode> {
|
||||
dbg!("Middleware hit");
|
||||
|
||||
let headers = request.headers();
|
||||
|
||||
dbg!("Headers extracted");
|
||||
|
||||
let auth_header = headers
|
||||
.get("authorization")
|
||||
.and_then(|v| v.to_str().ok());
|
||||
let auth_header = headers.get("authorization").and_then(|v| v.to_str().ok());
|
||||
|
||||
dbg!("Auth header: {:?}", auth_header);
|
||||
|
||||
@@ -51,4 +44,4 @@ pub async fn auth_middleware(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user