Skip to main content

agp_config/
auth.rs

1// Copyright AGNTCY Contributors (https://github.com/agntcy)
2// SPDX-License-Identifier: Apache-2.0
3
4pub mod basic;
5pub mod bearer;
6
7use thiserror::Error;
8
9#[derive(Error, Debug)]
10pub enum AuthError {
11    #[error("config error: {0}")]
12    ConfigError(String),
13}
14
15pub trait ClientAuthenticator {
16    // associated types
17    type ClientLayer;
18
19    fn get_client_layer(&self) -> Result<Self::ClientLayer, AuthError>;
20}
21
22pub trait ServerAuthenticator<Response> {
23    // associated types
24    type ServerLayer;
25
26    fn get_server_layer(&self) -> Result<Self::ServerLayer, AuthError>;
27}