Struct http_signature_normalization_actix::middleware::VerifySignature[][src]

pub struct VerifySignature<T>(_, _, _, _);

The Verify signature middleware

let middleware = VerifySignature::new(MyVerifier::new(), Config::default())
    .authorization()
    .optional();

HttpServer::new(move || {
    App::new()
        .wrap(middleware.clone())
        .route("/protected", web::post().to(|_: SignatureVerified| "Verified Authorization Header"))
        .route("/unprotected", web::post().to(|| "No verification required"))
})

Implementations

impl<T> VerifySignature<T> where
    T: SignatureVerify
[src]

pub fn new(verify_signature: T, config: Config) -> Self[src]

Create a new middleware for verifying HTTP Signatures. A type implementing SignatureVerify is required, as well as a Config

By default, this middleware expects to verify Signature headers, and requires the presence of the header

pub fn authorization(self) -> Self[src]

Verify Authorization headers instead of Signature headers

pub fn optional(self) -> Self[src]

Mark the presence of a Signature or Authorization header as optional

If a header is present, it will be verified, but if there is not one present, the request is passed through. This can be used to set a global middleware, and then guard each route handler with the SignatureVerified type.

Trait Implementations

impl<T: Clone> Clone for VerifySignature<T>[src]

impl<T: Debug> Debug for VerifySignature<T>[src]

impl<T, S, B> Transform<S, ServiceRequest> for VerifySignature<T> where
    T: SignatureVerify + Clone + 'static,
    S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error> + 'static,
    S::Error: 'static,
    B: MessageBody + 'static, 
[src]

type Response = ServiceResponse<B>

Responses given by the service.

type Error = Error

Errors produced by the service.

type Transform = VerifyMiddleware<T, S>

The TransformService value created by this factory

type InitError = ()

Errors produced while building a transform service.

type Future = Ready<Result<Self::Transform, Self::InitError>>

The future response value.

Auto Trait Implementations

impl<T> RefUnwindSafe for VerifySignature<T> where
    T: RefUnwindSafe
[src]

impl<T> Send for VerifySignature<T> where
    T: Send
[src]

impl<T> Sync for VerifySignature<T> where
    T: Sync
[src]

impl<T> Unpin for VerifySignature<T> where
    T: Unpin
[src]

impl<T> UnwindSafe for VerifySignature<T> where
    T: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,