Skip to main content

Module auth

Module auth 

Source
Expand description

Authentication interceptor and credential storage.

AuthInterceptor injects Authorization headers from a CredentialsStore before each request. InMemoryCredentialsStore provides a simple in-process credential store.

§Usage

use std::sync::Arc;
use a2a_protocol_client::auth::{
    InMemoryCredentialsStore, AuthInterceptor, SessionId, CredentialsStore,
};
use a2a_protocol_client::ClientBuilder;

let store = Arc::new(InMemoryCredentialsStore::new());
let session = SessionId::new("my-session");
store.set(session.clone(), "bearer", "my-token".into());

let _builder = ClientBuilder::new("http://localhost:8080")
    .with_interceptor(AuthInterceptor::new(store, session));

Structs§

AuthInterceptor
A CallInterceptor that injects Authorization headers from a CredentialsStore.
InMemoryCredentialsStore
An in-memory CredentialsStore backed by an RwLock<HashMap>.
SessionId
Opaque identifier for a client authentication session.

Traits§

CredentialsStore
Persistent storage for auth credentials, keyed by session + scheme.