# Trait actix_web_httpauth::extractors::AuthExtractor

source · [−]

    pub trait AuthExtractor: Sized {
        type Error: Into<Error>;
        type Future: Future<Output = Result<Self, Self::Error>>;
        fn from_service_request(req: &ServiceRequest) -> Self::Future;
    }

Expand description

Trait implemented by types that can extract HTTP authentication scheme credentials from the request.

It is very similar to actix’ `FromRequest` trait, except it operates with a `ServiceRequest` struct instead, therefore it can be used in the middlewares.

You will not need it unless you want to implement your own authentication scheme.

## Associated Types

source

#### type Error: Into<Error>

The associated error which can be returned.

source

#### type Future: Future<Output = Result<Self, Self::Error>>

Future that resolves into extracted credentials type.

## Required methods

source

#### fn from_service_request(req: &ServiceRequest) -> Self::Future

Parse the authentication credentials from the actix’ `ServiceRequest`.

## Implementations on Foreign Types

source

### impl<T: AuthExtractor> AuthExtractor for Option<T>

#### type Error = T::Error

#### type Future = AuthExtractorOptFut<T::Future>

source

#### fn from_service_request(req: &ServiceRequest) -> Self::Future

source

### impl<T: AuthExtractor> AuthExtractor for Result<T, T::Error>

#### type Error = T::Error

#### type Future = AuthExtractorResFut<T::Future>

source

#### fn from_service_request(req: &ServiceRequest) -> Self::Future

## Implementors

source

### impl AuthExtractor for BasicAuth

#### type Error = AuthenticationError<Challenge>

#### type Future = Ready<Result<Self, Self::Error>>

source

### impl AuthExtractor for BearerAuth

#### type Future = Ready<Result<Self, Self::Error>>

#### type Error = AuthenticationError<Bearer>