Struct actix_web_httpauth::extractors::bearer::BearerAuth [−][src]
Extractor for HTTP Bearer auth
Example
use actix_web_httpauth::extractors::bearer::BearerAuth; async fn index(auth: BearerAuth) -> String { format!("Hello, user with token {}!", auth.token()) }
If authentication fails, this extractor fetches the Config
instance
from the [app data] in order to properly form the WWW-Authenticate
response header.
Example
use actix_web::{web, App}; use actix_web_httpauth::extractors::bearer::{BearerAuth, Config}; async fn index(auth: BearerAuth) -> String { format!("Hello, {}!", auth.token()) } fn main() { let app = App::new() .data( Config::default() .realm("Restricted area") .scope("email photo"), ) .service(web::resource("/index.html").route(web::get().to(index))); }
Implementations
impl BearerAuth
[src]
Trait Implementations
impl AuthExtractor for BearerAuth
[src]
type Future = Ready<Result<Self, Self::Error>>
Future that resolves into extracted credentials type.
type Error = AuthenticationError<Bearer>
The associated error which can be returned.
fn from_service_request(req: &ServiceRequest) -> Self::Future
[src]
impl Clone for BearerAuth
[src]
fn clone(&self) -> BearerAuth
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for BearerAuth
[src]
impl FromRequest for BearerAuth
[src]
type Config = Config
Configuration for this extractor.
type Future = Ready<Result<Self, Self::Error>>
Future that resolves to a Self.
type Error = AuthenticationError<Bearer>
The associated error which can be returned.
fn from_request(req: &HttpRequest, _payload: &mut Payload) -> Self::Future
[src]
pub fn extract(req: &HttpRequest) -> Self::Future
pub fn configure<F>(f: F) -> Self::Config where
F: FnOnce(Self::Config) -> Self::Config,
F: FnOnce(Self::Config) -> Self::Config,
Auto Trait Implementations
impl RefUnwindSafe for BearerAuth
impl Send for BearerAuth
impl Sync for BearerAuth
impl Unpin for BearerAuth
impl UnwindSafe for BearerAuth
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,