Skip to main content

Authorizer

Trait Authorizer 

pub trait Authorizer<C>:
    Send
    + Sync
    + 'static {
    type Error: Send + 'static;

    // Required method
    fn authorize(
        &self,
        credentials: C,
    ) -> impl Future<Output = AuthorizeResult<C, Self::Error>> + Send;
}
Available on crate feature net only.
Expand description

The Authorizer trait is used to determine if the given credentials are authorized.

Required Associated Types§

type Error: Send + 'static

Returned in case the credentials are not authorized.

Required Methods§

fn authorize( &self, credentials: C, ) -> impl Future<Output = AuthorizeResult<C, Self::Error>> + Send

Authorize the given credentials.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

§

impl<C> Authorizer<C> for ()
where C: Send + 'static,

§

type Error = Unauthorized

§

async fn authorize( &self, credentials: C, ) -> AuthorizeResult<C, <() as Authorizer<C>>::Error>

§

impl<C> Authorizer<C> for bool
where C: Send + 'static,

§

type Error = Unauthorized

§

async fn authorize( &self, credentials: C, ) -> AuthorizeResult<C, <bool as Authorizer<C>>::Error>

§

impl<const N: usize, A, C> Authorizer<C> for [A; N]
where A: Authorizer<C>, C: Send + Sync + 'static,

§

type Error = <A as Authorizer<C>>::Error

§

async fn authorize( &self, credentials: C, ) -> AuthorizeResult<C, <[A; N] as Authorizer<C>>::Error>

Implementors§

§

impl<A, C> Authorizer<C> for Arc<A>
where A: Authorizer<C>, C: Send + 'static,

§

type Error = <A as Authorizer<C>>::Error

§

impl<A, C> Authorizer<C> for HttpAuthorizer<A, C>
where A: Authorizer<C>, <A as Authorizer<C>>::Error: Debug, C: Credentials + Send + 'static,

§

impl<A, C> Authorizer<C> for Vec<A>
where A: Authorizer<C>, C: Send + Sync + 'static,

§

type Error = <A as Authorizer<C>>::Error

§

impl<C> Authorizer<C> for StaticAuthorizer<C>
where C: PartialEq + Send + Sync + 'static,

§

impl<F, Fut, E, C> Authorizer<C> for F
where F: Fn(C) -> Fut + Send + Sync + 'static, Fut: Future<Output = AuthorizeResult<C, E>> + Send + 'static, E: Send + 'static, C: Send + 'static,

§

type Error = E