actix_web_httpauth/extractors/
config.rs

1use super::AuthenticationError;
2use crate::headers::www_authenticate::Challenge;
3
4/// Trait implemented for types that provides configuration for the authentication
5/// [extractors](crate::extractors).
6pub trait AuthExtractorConfig {
7    /// Associated challenge type.
8    type Inner: Challenge;
9
10    /// Convert the config instance into a HTTP challenge.
11    fn into_inner(self) -> Self::Inner;
12}
13
14impl<T> From<T> for AuthenticationError<<T as AuthExtractorConfig>::Inner>
15where
16    T: AuthExtractorConfig,
17{
18    fn from(config: T) -> Self {
19        AuthenticationError::new(config.into_inner())
20    }
21}