Skip to main content

tiny_proxy/auth/
mod.rs

1//! Authentication and authorization module for tiny-proxy
2//!
3//! This module provides functionality for:
4//! - Token validation via external services
5//! - Header manipulation and substitution
6//! - Authentication middleware integration
7//!
8//! # Example
9//!
10//! ```no_run
11//! use tiny_proxy::auth;
12//! use hyper::Request;
13//!
14//! # async fn example(req: Request<hyper::body::Incoming>) -> anyhow::Result<()> {
15//! // Validate a token using an external validator
16//! let is_valid = auth::validate_token(&req, "https://auth.example.com/validate").await?;
17//!
18//! // Process header substitutions
19//! let value = auth::process_header_substitution("Bearer {header.Authorization}", &req)?;
20//! # Ok(())
21//! # }
22//! ```
23
24pub mod headers;
25pub mod validator;
26
27// Re-export commonly used functions for convenience
28pub use headers::process_header_substitution;
29pub use validator::validate_token;