[−][src]Struct http_signature_normalization_actix::middleware::VerifySignature
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")) })
Methods
impl<T> VerifySignature<T> where
T: SignatureVerify,
[src]
T: SignatureVerify,
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]
fn clone(&self) -> VerifySignature<T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Debug> Debug for VerifySignature<T>
[src]
impl<T, S> Transform<S> for VerifySignature<T> where
T: SignatureVerify + Clone + 'static,
S: Service<Request = ServiceRequest, Response = ServiceResponse<Body>, Error = Error> + 'static,
S::Error: 'static,
[src]
T: SignatureVerify + Clone + 'static,
S: Service<Request = ServiceRequest, Response = ServiceResponse<Body>, Error = Error> + 'static,
S::Error: 'static,
type Request = ServiceRequest
Requests handled by the service.
type Response = ServiceResponse<Body>
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.
fn new_transform(&self, service: S) -> Self::Future
[src]
fn map_init_err<F, E>(self, f: F) -> TransformMapInitErr<Self, S, F, E> where
F: Fn(Self::InitError) -> E + Clone,
F: Fn(Self::InitError) -> E + Clone,
Auto Trait Implementations
impl<T> RefUnwindSafe for VerifySignature<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for VerifySignature<T> where
T: Send,
T: Send,
impl<T> Sync for VerifySignature<T> where
T: Sync,
T: Sync,
impl<T> Unpin for VerifySignature<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for VerifySignature<T> where
T: UnwindSafe,
T: UnwindSafe,
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,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[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.
fn to_owned(&self) -> T
[src]
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.
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.
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>,