athena_rs 3.18.0

Hyper performant polyglot Database driver
Documentation
//! Schema route auth and rate-limit context helpers.
//!
//! This module preserves a stable schema auth entrypoint while auth concerns
//! are split by policy domain:
//! - `gateway_read` for gateway/admin read-right authorization
//! - `inbound_rate_limit` for optional inbound request throttling

mod gateway_read;
mod inbound_rate_limit;

use actix_web::{HttpRequest, HttpResponse};

use self::gateway_read::require_schema_read_authorization;
use self::inbound_rate_limit::rate_limit_schema;
use crate::AppState;

/// Enforces schema-route read authorization and optional inbound rate limiting.
pub(super) async fn authorize_schema_read(
    req: &HttpRequest,
    app_state: &AppState,
    client_name: Option<&str>,
) -> Result<(), HttpResponse> {
    require_schema_read_authorization(req, app_state, client_name).await?;
    rate_limit_schema(req, app_state)
}