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;
}net only.Expand description
The Authorizer trait is used to determine if the given credentials are authorized.
Required Associated Types§
Required Methods§
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,
impl<C> Authorizer<C> for ()where
C: Send + 'static,
type Error = Unauthorized
§impl<C> Authorizer<C> for boolwhere
C: Send + 'static,
impl<C> Authorizer<C> for boolwhere
C: Send + 'static,
type Error = Unauthorized
§impl<const N: usize, A, C> Authorizer<C> for [A; N]
Authorizes the credentials which any of its authorizers authorizes.
impl<const N: usize, A, C> Authorizer<C> for [A; N]
Authorizes the credentials which any of its authorizers authorizes.
An empty list rejects all credentials. Wrap an Authorizer in an Option
for authentication that is not required when nothing is configured.
type Error = AuthorizerListError<<A as Authorizer<C>>::Error>
Implementors§
§impl<A, C> Authorizer<C> for Arc<A>where
A: Authorizer<C>,
C: Send + 'static,
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>
impl<A, C> Authorizer<C> for HttpAuthorizer<A, C>
§impl<A, C> Authorizer<C> for Option<A>where
A: Authorizer<C>,
C: Send + 'static,
None requires no authentication and authorizes all credentials;
Some delegates to its Authorizer.
impl<A, C> Authorizer<C> for Option<A>where
A: Authorizer<C>,
C: Send + 'static,
None requires no authentication and authorizes all credentials;
Some delegates to its Authorizer.
Use it to express “no authorizer configured means open”, as an empty list of authorizers rejects all credentials.
type Error = <A as Authorizer<C>>::Error
§impl<A, C> Authorizer<C> for Vec<A>
Authorizes the credentials which any of its authorizers authorizes.
impl<A, C> Authorizer<C> for Vec<A>
Authorizes the credentials which any of its authorizers authorizes.
An empty list rejects all credentials. Wrap an Authorizer in an Option
for authentication that is not required when nothing is configured.