velocia 0.3.0

velocia – production-ready AI agent framework using ADK-Rust, A2A protocol, and AWS DynamoDB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use async_trait::async_trait;
use axum::http::HeaderMap;

use crate::config::auth::SecurityScheme;
use crate::error::Result;

/// Abstraction over different credential-validation strategies (NoAuth, Cognito…).
#[async_trait]
pub trait AuthStrategy: Send + Sync {
    /// Fetch the JWKS or equivalent key material for the given security scheme.
    async fn get_keys(&self, scheme: &SecurityScheme) -> Result<serde_json::Value>;

    /// Extract the raw bearer token (or equivalent credential) from request headers.
    fn get_token(&self, headers: &HeaderMap) -> Result<String>;

    /// Validate the credential against `keys` and return the decoded claims.
    fn validate_token(&self, token: &str, keys: &serde_json::Value) -> Result<serde_json::Value>;
}