pub async fn auth_layer(
__arg0: State<SecurityState>,
__arg1: ConnectInfo<SocketAddr>,
request: Request,
next: Next,
) -> ResponseExpand description
Authentication middleware layer for axum
Checks the Authorization header for a valid bearer token.
§Example
ⓘ
use axum::{Router, routing::get, middleware};
use ruvector_security::middleware::{auth_layer, SecurityState};
let security = SecurityState::production("my_secret_token");
let app = Router::new()
.route("/api", get(|| async { "protected" }))
.layer(middleware::from_fn_with_state(security, auth_layer));