Skip to main content

AuthHandler

Trait AuthHandler 

Source
pub trait AuthHandler: Send + Sync {
    // Required method
    fn authorize<'a>(
        &'a self,
        remote_id: EndpointId,
        req: &'a HttpProxyRequest,
    ) -> impl Future<Output = Result<(), AuthError>> + Send + 'a;
}
Expand description

Authorizes proxy requests from remote endpoints.

Implement this trait to control which requests are allowed through the upstream proxy. Authorization decisions can be based on the remote endpoint identity, request target, headers, or any other criteria.

Required Methods§

Source

fn authorize<'a>( &'a self, remote_id: EndpointId, req: &'a HttpProxyRequest, ) -> impl Future<Output = Result<(), AuthError>> + Send + 'a

Checks if the request from remote_id should be authorized.

Returns Ok(()) to allow the request, or an AuthError to reject it.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<DYNOSAUR> AuthHandler for &DYNOSAUR
where DYNOSAUR: ?Sized + AuthHandler, Self: Send + Sync,

Source§

fn authorize<'a>( &'a self, remote_id: EndpointId, req: &'a HttpProxyRequest, ) -> impl Future<Output = Result<(), AuthError>> + Send

Source§

impl<DYNOSAUR> AuthHandler for &mut DYNOSAUR
where DYNOSAUR: ?Sized + AuthHandler, Self: Send + Sync,

Source§

fn authorize<'a>( &'a self, remote_id: EndpointId, req: &'a HttpProxyRequest, ) -> impl Future<Output = Result<(), AuthError>> + Send

Source§

impl<DYNOSAUR> AuthHandler for Box<DYNOSAUR>
where DYNOSAUR: ?Sized + AuthHandler, Self: Send + Sync,

Source§

fn authorize<'a>( &'a self, remote_id: EndpointId, req: &'a HttpProxyRequest, ) -> impl Future<Output = Result<(), AuthError>> + Send

Implementors§